static MemberKey newInstance ( Object contextObject , String name ) { if ( contextObject instanceof Class < ? > ) { Class < ? > clazz = ( Class < ? > ) contextObject ; if ( clazz . isEnum ( ) && ( "values" . equals ( name ) || Reflections . isConstantName ( clazz , name ) ) ) { // Special handling for enums - allows to access values() and constants return new MemberKey ( clazz , name ) ; } } return new MemberKey ( contextObject . getClass ( ) , name ) ; }
Simple factory method to obtain a new instance for the given context object and name .