org.biopax.paxtools.controller
Class PropertyEditor

java.lang.Object
  extended by org.biopax.paxtools.controller.PropertyEditor
Direct Known Subclasses:
EnumeratedPropertyEditor, ObjectPropertyEditor, PrimitivePropertyEditor, StringPropertyEditor

public abstract class PropertyEditor
extends java.lang.Object

This is the base class for all property editors. Each property controller is responsible for manipulating a certain property for a given class of objects (domain).


Field Summary
protected  java.lang.reflect.Method addMethod
          This variable stores the method to invoke for adding the given value to the property managed by this editor.
protected  java.lang.Class domain
          This is the Class representing the domain of the property.
protected  java.lang.reflect.Method getMethod
          This variable stores the method to invoke for getting the value of the property on a given bean.
protected static org.apache.commons.logging.Log log
           
protected  boolean multipleCardinality
          This is false if there is a cardinality restriction of one on the property.
protected  java.lang.String property
          Local OWL name of the property
protected  java.lang.Class range
          This is the Class representing the range of the property.
protected  java.lang.reflect.Method removeMethod
          This variable stores the method for removing the value of the property on a given bean.
protected  java.lang.reflect.Method setMethod
          This variable stores the method to invoke for setting a property to the to the given value.
 
Constructor Summary
PropertyEditor(java.lang.String property, java.lang.reflect.Method getMethod, java.lang.Class domain, java.lang.Class range, boolean multipleCardinality)
           
 
Method Summary
 void addMaxCardinalityRestriction(java.lang.Class domain, int max)
           
protected  void checkRestrictions(java.lang.Object bean, java.lang.Object value)
           
static PropertyEditor createPropertyEditor(java.lang.Class domain, java.lang.String property)
          This method creates a property reflecting on the domain and property.
 java.lang.reflect.Method getAddMethod()
           
 java.lang.Class getDomain()
           
 java.lang.reflect.Method getGetMethod()
           
 java.lang.Integer getMaxCardinality(java.lang.Class restrictedDomain)
           
 java.lang.reflect.Method getPrimarySetMethod()
           
 java.lang.String getProperty()
           
 java.lang.Class getRange()
           
 java.lang.reflect.Method getRemoveMethod()
           
 java.lang.reflect.Method getSetMethod()
           
 java.lang.Object getValueFromBean(java.lang.Object bean)
           
protected  void invokeMethod(java.lang.reflect.Method method, java.lang.Object bean, java.lang.Object value)
           
protected  boolean isInstanceOfAtLeastOne(java.util.Set<java.lang.Class> classes, java.lang.Object value)
           
 boolean isMultipleCardinality()
           
 boolean isUnknown(java.lang.Object value)
           
 void removePropertyFromBean(java.lang.Object value, java.lang.Object bean)
           
 void setPropertyToBean(java.lang.Object value, java.lang.Object bean)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log

setMethod

protected java.lang.reflect.Method setMethod
This variable stores the method to invoke for setting a property to the to the given value. If multiple cardinality, the returned method is expected to have a Set as its only parameter.


getMethod

protected java.lang.reflect.Method getMethod
This variable stores the method to invoke for getting the value of the property on a given bean. In the case of multiple cardinality, this method is expected to return a Set otherwise an instance of range


addMethod

protected java.lang.reflect.Method addMethod
This variable stores the method to invoke for adding the given value to the property managed by this editor. In the case of multiple cardinality, the method is expected to have a range as its only parameter, otherwise expected to be null.


removeMethod

protected java.lang.reflect.Method removeMethod
This variable stores the method for removing the value of the property on a given bean. In the case of multiple cardinality, this method is expected to have a range as its only parameter, otherwise expected to be null


domain

protected java.lang.Class domain
This is the Class representing the domain of the property.


range

protected java.lang.Class range
This is the Class representing the range of the property. It is by default an object.


property

protected java.lang.String property
Local OWL name of the property


multipleCardinality

protected boolean multipleCardinality
This is false if there is a cardinality restriction of one on the property.

Constructor Detail

PropertyEditor

public PropertyEditor(java.lang.String property,
                      java.lang.reflect.Method getMethod,
                      java.lang.Class domain,
                      java.lang.Class range,
                      boolean multipleCardinality)
Method Detail

createPropertyEditor

public static PropertyEditor createPropertyEditor(java.lang.Class domain,
                                                  java.lang.String property)
This method creates a property reflecting on the domain and property. Proper subclass is chosen based on the range of the property.

Parameters:
domain - paxtools level2 interface that maps to the corresponding owl level2.
property - to be managed by the constructed controller.
Returns:
a property controller to manipulate the beans for the given property.

getAddMethod

public java.lang.reflect.Method getAddMethod()

getDomain

public java.lang.Class getDomain()

getGetMethod

public java.lang.reflect.Method getGetMethod()

getProperty

public java.lang.String getProperty()

getRange

public java.lang.Class getRange()

getRemoveMethod

public java.lang.reflect.Method getRemoveMethod()

getSetMethod

public java.lang.reflect.Method getSetMethod()

isMultipleCardinality

public boolean isMultipleCardinality()

addMaxCardinalityRestriction

public void addMaxCardinalityRestriction(java.lang.Class domain,
                                         int max)

getMaxCardinality

public java.lang.Integer getMaxCardinality(java.lang.Class restrictedDomain)

isInstanceOfAtLeastOne

protected boolean isInstanceOfAtLeastOne(java.util.Set<java.lang.Class> classes,
                                         java.lang.Object value)

isUnknown

public boolean isUnknown(java.lang.Object value)

removePropertyFromBean

public void removePropertyFromBean(java.lang.Object value,
                                   java.lang.Object bean)

invokeMethod

protected void invokeMethod(java.lang.reflect.Method method,
                            java.lang.Object bean,
                            java.lang.Object value)

setPropertyToBean

public void setPropertyToBean(java.lang.Object value,
                              java.lang.Object bean)

checkRestrictions

protected void checkRestrictions(java.lang.Object bean,
                                 java.lang.Object value)

getValueFromBean

public java.lang.Object getValueFromBean(java.lang.Object bean)

getPrimarySetMethod

public java.lang.reflect.Method getPrimarySetMethod()