Package org.incenp.obofoundry.sssom
Class VersionComplianceVisitor<T>
- java.lang.Object
-
- org.incenp.obofoundry.sssom.slots.SlotVisitorBase<T>
-
- org.incenp.obofoundry.sssom.VersionComplianceVisitor<T>
-
- Type Parameters:
T- The type of object whose compliance must be checked.
- All Implemented Interfaces:
ISlotVisitor<T>
public class VersionComplianceVisitor<T> extends SlotVisitorBase<T>
Helper visitor to determine the minimum version of the SSSOM specification is required by a mapping or a mapping set.
-
-
Constructor Summary
Constructors Constructor Description VersionComplianceVisitor()Creates a new instance.VersionComplianceVisitor(Set<Version> versions)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VersiongetVersion()Gets the minimum version required, according to the slots visited so far.voidvisit(EntityTypeSlot<T> slot, T object, EntityType value)Visits a slot that holds an entity type enumeration value.voidvisit(MappingCardinalitySlot<T> slot, T object, MappingCardinality value)Visits a slot that holds a mapping cardinality enumeration value.voidvisit(Slot<T> slot, T object, Object unused)Visits a generic slot.voidvisit(VersionSlot<T> slot, T object, Version unused)Visits a slot that holds a SSSOM version value.
-
-
-
Constructor Detail
-
VersionComplianceVisitor
public VersionComplianceVisitor()
Creates a new instance.When using this constructor, use
getVersion()to get the minimum version required by a set or a mapping, after visiting the slots.
-
VersionComplianceVisitor
public VersionComplianceVisitor(Set<Version> versions)
Creates a new instance.Use this constructor to share the set of visited versions across visitors (e.g., between a visitor for mapping sets and a visitor for mappings).
- Parameters:
versions- The set that will hold the accumulated version objects.
-
-
Method Detail
-
getVersion
public Version getVersion()
Gets the minimum version required, according to the slots visited so far.- Returns:
- Gets the version that defines all slots and all values in the slots that have been visited up to that point.
-
visit
public void visit(Slot<T> slot, T object, Object unused)
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.unused- The value of the slot.
-
visit
public void visit(EntityTypeSlot<T> slot, T object, EntityType value)
Description copied from interface:ISlotVisitorVisits a slot that holds an entity type enumeration value.- 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(MappingCardinalitySlot<T> slot, T object, MappingCardinality value)
Description copied from interface:ISlotVisitorVisits a slot that holds a mapping cardinality enumeration value.- 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(VersionSlot<T> slot, T object, Version unused)
Description copied from interface:ISlotVisitorVisits a slot that holds a SSSOM version value.- 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.unused- The value of the slot.
-
-