Class SlotExtractor<T>
- java.lang.Object
-
- org.incenp.obofoundry.sssom.slots.SlotVisitorBase<T>
-
- org.incenp.obofoundry.sssom.extract.SlotExtractor<T>
-
- Type Parameters:
T- The type of object from which to extract a slot value (MappingSetorMapping).
- All Implemented Interfaces:
ISlotVisitor<T>
public class SlotExtractor<T> extends SlotVisitorBase<T>
Common logic used by both theMappingSetSlotExtractorand theMappingSlotExtractorclasses.
-
-
Constructor Summary
Constructors Constructor Description SlotExtractor(Slot<T> slot)Creates a new instance.SlotExtractor(Slot<T> slot, int itemNo)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetSlotValue(T object)Performs the actual extraction.Class<?>getType()Returns the type of the extracted value.voidvisit(Slot<T> slot, T object, Object value)Visits a generic slot.voidvisit(StringSlot<T> slot, T object, List<String> values)Visits a multi-valued string-typed slot.
-
-
-
Method Detail
-
getSlotValue
public Object getSlotValue(T object)
Performs the actual extraction.- Parameters:
object- The object from which to extract the slot value.- Returns:
- The extract value, or
nullif the object does not have a value at the specified location.
-
getType
public Class<?> getType()
Returns the type of the extracted value.- Returns:
- The type of the value that would be returned by
getSlotValue(Object).
-
visit
public void visit(Slot<T> slot, T object, Object value)
Description copied from interface:ISlotVisitorVisits a generic slot.This method is normally not used as all slots in a SSSOM object have more precise types. But it can be used to implement behaviours that should be common to several slot types.
- Specified by:
visitin interfaceISlotVisitor<T>- Overrides:
visitin classSlotVisitorBase<T>- Parameters:
slot- The slot that is being visited.object- The object to which the slot is attached.value- The value of the slot.
-
visit
public void visit(StringSlot<T> slot, T object, List<String> values)
Description copied from interface:ISlotVisitorVisits a multi-valued string-typed slot.- Specified by:
visitin interfaceISlotVisitor<T>- Overrides:
visitin classSlotVisitorBase<T>- Parameters:
slot- The slot that is being visited.object- The object to which the slot is attached.values- The values of the slot.
-
-