protected T getParentFromConfig ( ) { //TODO: Move this to a converter String parentName = Config . get ( canonicalName ( ) , "parent" ) . asString ( null ) ; if ( parentName != null && DynamicEnum . isDefined ( Cast . as ( getClass ( ) ) , parentName ) ) { return DynamicEnum . valueOf ( Cast . as ( getClass ( ) ) , parentName ) ; } else if ( parentName != null ) { try { parentName = parentName . replaceFirst ( Pattern . quote ( getClass ( ) . getCanonicalName ( ) ) , "" ) ; DynamicEnum . register ( Cast . as ( Reflect . onClass ( getClass ( ) ) . invoke ( "create" , parentName ) . get ( ) ) ) ; } catch ( ReflectionException e ) { return null ; } } return null ; }
Determines the parent via a configuration setting .