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>
Common logic used by both the
MappingSetSlotExtractor and the
MappingSlotExtractor classes.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSlotExtractor(Slot<T> slot) Creates a new instance.SlotExtractor(Slot<T> slot, int itemNo) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptiongetSlotValue(T object) Performs the actual extraction.Class<?> getType()Returns the type of the extracted value.voidVisits a generic slot.voidVisits a multi-valued string-typed slot.
-
Field Details
-
slot
-
itemNo
protected int itemNo
-
-
Constructor Details
-
SlotExtractor
Creates a new instance.If the slot is a multi-valued slot, this will extract the first value.
- Parameters:
slot- The slot to extract.
-
SlotExtractor
Creates a new instance.- Parameters:
slot- The slot to extract.itemNo- The 0-based index of the value to extract, or (if negative) the 1-based index starting from the last value. This is only meaningful for a multi-valued slot.
-
-
Method Details
-
getSlotValue
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
Returns the type of the extracted value.- Returns:
- The type of the value that would be returned by
getSlotValue(Object).
-
visit
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
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.
-