org.biopax.paxtools.controller
Class SimplePropertyAccessor<D extends BioPAXElement,R>

java.lang.Object
  extended by org.biopax.paxtools.controller.SimplePropertyAccessor<D,R>
All Implemented Interfaces:
PropertyAccessor<D,R>
Direct Known Subclasses:
PropertyEditor

public class SimplePropertyAccessor<D extends BioPAXElement,R>
extends java.lang.Object


Field Summary
protected  java.lang.Class<D> 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  boolean multipleCardinality
          This is false if there is a cardinality restriction of one on the property.
protected  java.lang.Class<R> range
          This is the Class representing the range of the property.
 
Constructor Summary
SimplePropertyAccessor(java.lang.Class<D> domain, java.lang.Class<R> range, boolean multipleCardinality, java.lang.reflect.Method getMethod)
           
 
Method Summary
 java.lang.Class<D> getDomain()
          Returns the domain of the property.
 java.lang.Class<R> getRange()
          Returns the range of the editor.
 java.util.Set<R> getValueFromBean(D bean)
          Returns the value of the bean using the default getMethod.
 boolean isMultipleCardinality()
          Checks if the property to which editor is assigned has multiple cardinality.
protected static boolean isMultipleCardinality(java.lang.reflect.Method getMethod)
           
 boolean isUnknown(java.lang.Object value)
          Checks if the value is unkown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

getMethod

protected final 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


domain

protected java.lang.Class<D extends BioPAXElement> domain
This is the Class representing the domain of the property.


range

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


multipleCardinality

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

Constructor Detail

SimplePropertyAccessor

public SimplePropertyAccessor(java.lang.Class<D> domain,
                              java.lang.Class<R> range,
                              boolean multipleCardinality,
                              java.lang.reflect.Method getMethod)
Method Detail

isMultipleCardinality

protected static boolean isMultipleCardinality(java.lang.reflect.Method getMethod)

getValueFromBean

public java.util.Set<R> getValueFromBean(D bean)
                                  throws IllegalBioPAXArgumentException
Returns the value of the bean using the default getMethod. If the value is unknown returns null or an empty set depending on the cardinality.

Parameters:
bean - the object whose property is requested
Returns:
an object as the value
Throws:
IllegalBioPAXArgumentException

isUnknown

public boolean isUnknown(java.lang.Object value)
Checks if the value is unkown. In this context a value is regarded to be unknown if it is null (unset).

Parameters:
value - the value to be checked
Returns:
true if the value is unknown

getDomain

public java.lang.Class<D> getDomain()
Returns the domain of the property.

Specified by:
getDomain in interface PropertyAccessor<D extends BioPAXElement,R>
Returns:
the domain of the editor

getRange

public java.lang.Class<R> getRange()
Returns the range of the editor.

Specified by:
getRange in interface PropertyAccessor<D extends BioPAXElement,R>
Returns:
a class

isMultipleCardinality

public boolean isMultipleCardinality()
Checks if the property to which editor is assigned has multiple cardinality.

Specified by:
isMultipleCardinality in interface PropertyAccessor<D extends BioPAXElement,R>
Returns:
true if editor belongs to a multiple cardinality property.


Copyright © 2011 BioPAX. All Rights Reserved.