Class EditorMapImpl

java.lang.Object
org.biopax.paxtools.controller.EditorMapImpl
All Implemented Interfaces:
EditorMap

public class EditorMapImpl extends Object implements EditorMap
This is the base adapter for all editor maps. A PropertyEditor is an object that can manipulate a certain property. Editor maps are responsible for initializing these editors and providing them. The default level is the latest official release of BioPAX.
  • Field Details

    • propertyToEditorMap

      protected final Map<String,Set<PropertyEditor>> propertyToEditorMap
      A map from property names to actual property editors. Since EditorMap keeps a separate editor for each target class( This is necessary to be able to validate class specific restrictions without instanceof checks), values are set of editors.
    • classToEditorMap

      protected final Map<Class<? extends BioPAXElement>,Map<String,PropertyEditor>> classToEditorMap
      A map from classes to their registered editors.
    • classToInverseEditorMap

      protected final Map<Class<? extends BioPAXElement>,Set<ObjectPropertyEditor>> classToInverseEditorMap
      A map from classes to their registered inverse editors
    • classToEditorSet

      protected final Map<Class<? extends BioPAXElement>,Set<PropertyEditor>> classToEditorSet
      Another map to keep editors as a set rather than a map. This is a small efficiency tweak as editors are create once objects, query multiple times objects.
    • level

      protected final BioPAXLevel level
  • Constructor Details

    • EditorMapImpl

      public EditorMapImpl(BioPAXLevel level)
  • Method Details

    • getEditorsOf

      public Set<PropertyEditor> getEditorsOf(BioPAXElement bpe)
      Description copied from interface: EditorMap
      This method returns the set of editors whose domain subsumes the class of given BioPAX element.
      Specified by:
      getEditorsOf in interface EditorMap
      Parameters:
      bpe - BioPAX element for which the available editors will be returned
      Returns:
      empty set if there are no such editors
    • getEditorsOf

      public Set<PropertyEditor> getEditorsOf(Class<? extends BioPAXElement> domain)
      Description copied from interface: EditorMap
      This method returns the set of editors whose domain subsumes the given class
      Specified by:
      getEditorsOf in interface EditorMap
      Parameters:
      domain - BioPAX model interface for which the available editors will be returned
      Returns:
      empty set if there are no such editors
    • getInverseEditorsOf

      public Set<ObjectPropertyEditor> getInverseEditorsOf(BioPAXElement bpe)
      Description copied from interface: EditorMap
      Properties in BioPAX specification is unidirectional. e.g. entityReference property that links a PhysicalEntity to EntityReference has no defined corresponding inverse property that links EntityReferences to their corresponding entities. Most OWL reasoners can query the inverse of a property at no additional cost, but for most OO implementations this would require an expensive O(n) lookup. An OO implementation requires keeping additional properties for efficiency purposes. Inverse editors are read-only editors that captures these "inverse" part of the bidirectional properties specifically implemented in Paxtools. They have the pattern PropertyNameOf e.g. entityReferenceOf.
      Specified by:
      getInverseEditorsOf in interface EditorMap
      Parameters:
      bpe - BioPAX element for which the available inverse editors will be returned.
      Returns:
      all inverse editors for this entity's class type.
    • getInverseEditorsOf

      public Set<ObjectPropertyEditor> getInverseEditorsOf(Class<? extends BioPAXElement> domain)
      Description copied from interface: EditorMap
      Properties in BioPAX specification is unidirectional. e.g. entityReference property that links a PhysicalEntity to EntityReference has no defined corresponding inverse property that links EntityReferences to their corresponding entities. Most OWL reasoners can query the inverse of a property at no additional cost, but for most OO implementations this would require an expensive O(n) lookup. An OO implementation requires keeping additional properties for efficiency purposes. Inverse editors are read-only editors that captures these "inverse" part of the bidirectional properties specifically implemented in Paxtools. They have the pattern PropertyNameOf e.g. entityReferenceOf.
      Specified by:
      getInverseEditorsOf in interface EditorMap
      Parameters:
      domain - of the inverse property
      Returns:
      all inverse editors for this class type.
    • getEditorForProperty

      public <D extends BioPAXElement> PropertyEditor<? super D,?> getEditorForProperty(String property, Class<D> javaClass)
      Description copied from interface: EditorMap
      This method returns the editor intended to handle property named property of a class (javaClass). This editor can then be used to modify the property of an element of class javaClass. To put in other words, this methods returns the editor of which domain includes javaClass, and the editor that can handle the property.
      Specified by:
      getEditorForProperty in interface EditorMap
      Type Parameters:
      D - domain
      Parameters:
      property - name of the property for which editor will be called
      javaClass - class of the element
      Returns:
      null if there is no such editor
    • getSubclassEditorsForProperty

      public <D extends BioPAXElement> Set<PropertyEditor<? extends D,?>> getSubclassEditorsForProperty(String property, Class<D> domain)
      Description copied from interface: EditorMap
      This method returns the set of editors intended to handle property named property. This editor can then be used to modify the property of an element which is in editor's domain list. In other words, this methods returns the set of the editors that can handle the property. Editors are not filtered for a specific domain class.
      Specified by:
      getSubclassEditorsForProperty in interface EditorMap
      Type Parameters:
      D - domain biopax type
      Parameters:
      property - name of the property for which editor will be called
      domain - biopax type/class the property belongs to
      Returns:
      empty set if there are no such editors
    • getEditorsForProperty

      public Set<PropertyEditor> getEditorsForProperty(String property)
      Description copied from interface: EditorMap
      This method returns the set of editors intended to handle property named property. This editor can then be used to modify the property of an element which is in editor's domain list. In other words, this methods returns the set of the editors that can handle the property. Editors are not filtered for a specific domain class.
      Specified by:
      getEditorsForProperty in interface EditorMap
      Parameters:
      property - name of the property for which editor will be called
      Returns:
      empty set if there are no such editors
    • getKnownSubClassesOf

      public <E extends BioPAXElement> Set<? extends Class<E>> getKnownSubClassesOf(Class<E> javaClass)
      Description copied from interface: EditorMap
      Returns a set of sub classes of a given class. This method can be used for class filtering methods.
      Specified by:
      getKnownSubClassesOf in interface EditorMap
      Type Parameters:
      E - biopax type (biopax object model interface)
      Parameters:
      javaClass - the class whose subclasses will be returned
      Returns:
      an empty set if there are no such editors
    • isInBioPAXNameSpace

      protected boolean isInBioPAXNameSpace(String nameSpace)
    • createAndRegisterBeanEditor

      protected PropertyEditor createAndRegisterBeanEditor(String pName, Class domain, Map<Class<? extends BioPAXElement>,Set<Class<? extends BioPAXElement>>> rRestrictions)
    • registerEditorsWithSubClasses

      protected void registerEditorsWithSubClasses(PropertyEditor editor, Class<? extends BioPAXElement> domain)
      This method registers an editor with sub classes - i.e. inserts the editor to the proper value in editor maps.
      Parameters:
      editor - to be registered
      domain - a subclass of the editor's original domain.
    • registerModelClass

      protected void registerModelClass(String localName)
      This method inserts the class into internal hashmaps and initializes the value collections.
      Parameters:
      localName - of the BioPAX class.
    • iterator

      public Iterator<PropertyEditor> iterator()
      Specified by:
      iterator in interface EditorMap
      Returns:
      An iterator over all the properties in this EditorMap
    • getLevel

      public BioPAXLevel getLevel()
      Description copied from interface: EditorMap
      Returns the BioPAX level for which editor map is created. Different BioPAX levels have different editor maps.
      Specified by:
      getLevel in interface EditorMap
      Returns:
      BioPAX Level