|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.biopax.paxtools.controller.SimplePropertyAccessor<D,R>
org.biopax.paxtools.controller.PropertyEditor<D,R>
public abstract class PropertyEditor<D extends BioPAXElement,R>
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 commander. |
protected java.lang.Class<D> |
domain
This is the Class representing the domain of the property. |
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<R> |
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. |
| Fields inherited from class org.biopax.paxtools.controller.SimplePropertyAccessor |
|---|
getMethod |
| Constructor Summary | |
|---|---|
PropertyEditor(java.lang.String property,
java.lang.reflect.Method getMethod,
java.lang.Class<D> domain,
java.lang.Class<R> range,
boolean multipleCardinality)
|
|
| Method Summary | ||
|---|---|---|
void |
addMaxCardinalityRestriction(java.lang.Class<? extends D> domain,
int max)
Sets a maximum cardinality for a domain. |
|
protected void |
checkRestrictions(R value,
D bean)
Checks if the bean and the value are consistent with the cardinality rules of the model. |
|
static
|
createPropertyEditor(java.lang.Class<D> domain,
java.lang.String property)
This method creates a property reflecting on the domain and property. |
|
protected static java.lang.Class |
detectRange(java.lang.reflect.Method getMethod)
Given the multiple cardinality feature, the range of the get method is returned. |
|
java.lang.reflect.Method |
getAddMethod()
Returns the addMethod. |
|
java.lang.Class<D> |
getDomain()
Returns the domain of the property. |
|
java.lang.reflect.Method |
getGetMethod()
Returns SimplePropertyAccessor.getMethod. |
|
java.lang.Integer |
getMaxCardinality(java.lang.Class<? extends D> restrictedDomain)
Return the maximum cardinality that is defined for the property to which editor is belong. |
|
java.lang.reflect.Method |
getPrimarySetMethod()
Returns the primary set method of the editor. |
|
java.lang.String |
getProperty()
Returns the property name. |
|
java.lang.Class<R> |
getRange()
Returns the range of the editor. |
|
java.lang.reflect.Method |
getRemoveMethod()
Returns the removeMethod. |
|
java.lang.reflect.Method |
getSetMethod()
Returns the setMethod. |
|
R |
getUnknown()
Gets the unknown value. |
|
protected void |
invokeMethod(java.lang.reflect.Method method,
D bean,
R value)
Calls the method onto bean with the value as its parameter. |
|
protected boolean |
isInstanceOfAtLeastOne(java.util.Set<java.lang.Class<? extends BioPAXElement>> classes,
java.lang.Object value)
Checks if value is an instance of one of the classes given in a set. |
|
boolean |
isMultipleCardinality()
Checks if the property to which editor is assigned has multiple cardinality. |
|
protected R |
parseValueFromString(java.lang.String value)
|
|
void |
removeValueFromBean(R value,
D bean)
Removes the value from the bean using the default removeMethod. |
|
void |
removeValueFromBean(java.util.Set<R> values,
D bean)
Removes the values from the bean using the removeValueFromBean(Object, BioPAXElement)
for each value in the set. |
|
void |
setValueToBean(R value,
D bean)
Sets the value to the bean using the default setMethod if
value is not null. |
|
void |
setValueToBean(java.util.Set<R> values,
D bean)
|
|
java.lang.String |
toString()
|
|
| Methods inherited from class org.biopax.paxtools.controller.SimplePropertyAccessor |
|---|
getValueFromBean, isMultipleCardinality, isUnknown |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.commons.logging.Log log
protected java.lang.reflect.Method setMethod
multiple cardinality, the returned method is expected to have a
Set as its only parameter.
protected java.lang.reflect.Method addMethod
range as its only parameter, otherwise expected to be null.
protected java.lang.reflect.Method removeMethod
range as its only
parameter, otherwise expected to be null
protected final java.lang.String property
protected java.lang.Class<D extends BioPAXElement> domain
protected java.lang.Class<R> range
protected final boolean multipleCardinality
| Constructor Detail |
|---|
public PropertyEditor(java.lang.String property,
java.lang.reflect.Method getMethod,
java.lang.Class<D> domain,
java.lang.Class<R> range,
boolean multipleCardinality)
| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Object
public static <D extends BioPAXElement,R> PropertyEditor<D,R> createPropertyEditor(java.lang.Class<D> domain,
java.lang.String property)
domain - paxtools level2 interface that maps to the corresponding owl level2.property - to be managed by the constructed controller.
protected static java.lang.Class detectRange(java.lang.reflect.Method getMethod)
getMethod - default method
public java.lang.reflect.Method getAddMethod()
addMethod.
public java.lang.reflect.Method getGetMethod()
SimplePropertyAccessor.getMethod.
public java.lang.String getProperty()
public java.lang.reflect.Method getRemoveMethod()
removeMethod.
public java.lang.reflect.Method getSetMethod()
setMethod.
public void addMaxCardinalityRestriction(java.lang.Class<? extends D> domain,
int max)
domain - domain on which restriction will be setmax - cardinalityisMultipleCardinality()public java.lang.Integer getMaxCardinality(java.lang.Class<? extends D> restrictedDomain)
restrictedDomain - domain to be checked for the cardinality
protected boolean isInstanceOfAtLeastOne(java.util.Set<java.lang.Class<? extends BioPAXElement>> classes,
java.lang.Object value)
classes - a set of classes to be checkedvalue - value whose class will be checked
public R getUnknown()
BioPAXElement.UNKNOWN_FLOAT)
public void removeValueFromBean(R value,
D bean)
removeMethod.
value - to be removed from the beanbean - bean from which the value is going to be removed
public void removeValueFromBean(java.util.Set<R> values,
D bean)
removeValueFromBean(Object, BioPAXElement)
for each value in the set.
values - to be removed from the beanbean - bean from which the value is going to be removed
protected void invokeMethod(java.lang.reflect.Method method,
D bean,
R value)
method - method that is going to be calledbean - bean onto which the method is going to be appliedvalue - the value which is going to be used by methodprotected R parseValueFromString(java.lang.String value)
public void setValueToBean(R value,
D bean)
setMethod if
value is not null.
value - to be set to the beanbean - to which the value is to be set
public void setValueToBean(java.util.Set<R> values,
D bean)
protected void checkRestrictions(R value,
D bean)
value - Value that is related to the objectbean - Object that is related to the valuepublic java.lang.reflect.Method getPrimarySetMethod()
setMethod for a property of
single cardinality, and the addMethod method for a property of multiple cardinality.
public java.lang.Class<D> getDomain()
getDomain in interface PropertyAccessor<D extends BioPAXElement,R>public java.lang.Class<R> getRange()
getRange in interface PropertyAccessor<D extends BioPAXElement,R>public boolean isMultipleCardinality()
isMultipleCardinality in interface PropertyAccessor<D extends BioPAXElement,R>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||