public static < D extends BioPAXElement , R > PropertyEditor < D , R > createPropertyEditor ( Class < D > domain , String property ) { PropertyEditor editor = null ; try { Method getMethod = detectGetMethod ( domain , property ) ; boolean multipleCardinality = isMultipleCardinality ( getMethod ) ; Class < R > range = detectRange ( getMethod ) ; if ( range . isPrimitive ( ) || range . equals ( Boolean . class ) ) { editor = new PrimitivePropertyEditor < D , R > ( property , getMethod , domain , range , multipleCardinality ) ; } else if ( range . isEnum ( ) ) { editor = new EnumeratedPropertyEditor ( property , getMethod , domain , range , multipleCardinality ) ; } else if ( range . equals ( String . class ) ) { editor = new StringPropertyEditor ( property , getMethod , domain , multipleCardinality ) ; } else { editor = new ObjectPropertyEditor ( property , getMethod , domain , range , multipleCardinality ) ; } } catch ( NoSuchMethodException e ) { if ( log . isWarnEnabled ( ) ) log . warn ( "Failed creating the controller for " + property + " on " + domain ) ; } return editor ; }
This method creates a property reflecting on the domain and property . Proper subclass is chosen based on the range of the property .