Package org.biopax.paxtools.controller
Class EditorMapImpl
java.lang.Object
org.biopax.paxtools.controller.EditorMapImpl
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<Class<? extends BioPAXElement>,Map<String, PropertyEditor>> A map from classes to their registered editors.protected final Map<Class<? extends BioPAXElement>,Set<PropertyEditor>> Another map to keep editors as a set rather than a map.protected final Map<Class<? extends BioPAXElement>,Set<ObjectPropertyEditor>> A map from classes to their registered inverse editorsprotected final BioPAXLevelprotected final Map<String,Set<PropertyEditor>> A map from property names to actual property editors. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PropertyEditorcreateAndRegisterBeanEditor(String pName, Class domain, Map<Class<? extends BioPAXElement>, Set<Class<? extends BioPAXElement>>> rRestrictions) <D extends BioPAXElement>
PropertyEditor<? super D,?> getEditorForProperty(String property, Class<D> javaClass) This method returns the editor intended to handle property named property of a class (javaClass).getEditorsForProperty(String property) This method returns the set of editors intended to handle property named property.getEditorsOf(Class<? extends BioPAXElement> domain) This method returns the set of editors whose domain subsumes the given classThis method returns the set of editors whose domain subsumes the class of given BioPAX element.getInverseEditorsOf(Class<? extends BioPAXElement> domain) Properties in BioPAX specification is unidirectional.Properties in BioPAX specification is unidirectional.<E extends BioPAXElement>
Set<? extends Class<E>>getKnownSubClassesOf(Class<E> javaClass) Returns a set of sub classes of a given class.getLevel()Returns the BioPAX level for which editor map is created.<D extends BioPAXElement>
Set<PropertyEditor<? extends D,?>> getSubclassEditorsForProperty(String property, Class<D> domain) This method returns the set of editors intended to handle property named property.protected booleanisInBioPAXNameSpace(String nameSpace) iterator()protected voidregisterEditorsWithSubClasses(PropertyEditor editor, Class<? extends BioPAXElement> domain) This method registers an editor with sub classes - i.e.protected voidregisterModelClass(String localName) This method inserts the class into internal hashmaps and initializes the value collections.
-
Field Details
-
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
A map from classes to their registered editors. -
classToInverseEditorMap
protected final Map<Class<? extends BioPAXElement>,Set<ObjectPropertyEditor>> classToInverseEditorMapA map from classes to their registered inverse editors -
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
-
-
Constructor Details
-
EditorMapImpl
-
-
Method Details
-
getEditorsOf
Description copied from interface:EditorMapThis method returns the set of editors whose domain subsumes the class of given BioPAX element.- Specified by:
getEditorsOfin interfaceEditorMap- Parameters:
bpe- BioPAX element for which the available editors will be returned- Returns:
- empty set if there are no such editors
-
getEditorsOf
Description copied from interface:EditorMapThis method returns the set of editors whose domain subsumes the given class- Specified by:
getEditorsOfin interfaceEditorMap- Parameters:
domain- BioPAX model interface for which the available editors will be returned- Returns:
- empty set if there are no such editors
-
getInverseEditorsOf
Description copied from interface:EditorMapProperties 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:
getInverseEditorsOfin interfaceEditorMap- Parameters:
bpe- BioPAX element for which the available inverse editors will be returned.- Returns:
- all inverse editors for this entity's class type.
-
getInverseEditorsOf
Description copied from interface:EditorMapProperties 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:
getInverseEditorsOfin interfaceEditorMap- 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:EditorMapThis 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:
getEditorForPropertyin interfaceEditorMap- Type Parameters:
D- domain- Parameters:
property- name of the property for which editor will be calledjavaClass- 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:EditorMapThis 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:
getSubclassEditorsForPropertyin interfaceEditorMap- Type Parameters:
D- domain biopax type- Parameters:
property- name of the property for which editor will be calleddomain- biopax type/class the property belongs to- Returns:
- empty set if there are no such editors
-
getEditorsForProperty
Description copied from interface:EditorMapThis 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:
getEditorsForPropertyin interfaceEditorMap- Parameters:
property- name of the property for which editor will be called- Returns:
- empty set if there are no such editors
-
getKnownSubClassesOf
Description copied from interface:EditorMapReturns a set of sub classes of a given class. This method can be used for class filtering methods.- Specified by:
getKnownSubClassesOfin interfaceEditorMap- 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
-
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 registereddomain- a subclass of the editor's original domain.
-
registerModelClass
This method inserts the class into internal hashmaps and initializes the value collections.- Parameters:
localName- of the BioPAX class.
-
iterator
-
getLevel
Description copied from interface:EditorMapReturns the BioPAX level for which editor map is created. Different BioPAX levels have different editor maps.
-