question: public static void addPropertyIntoObject ( FileSystemObjectProperties key , String value , Object instance ) throws Exception { if ( null != value ) { Method method = PropertySetterUtil . getMethod ( key . getMethodName ( ) , instance ) ; if ( null == method ) { return ; } Object typeCastedValue = PropertySetterUtil . typeCast ( value , method ) ; if ( null == typeCastedValue ) { return ; } Object [ ] args = new Object [ ] { typeCastedValue } ; if ( null != method ) { method . invoke ( instance , args ) ; } } }
target:  filesystemObjectProperties, an enum, associating key with its MethodName e.g. invoke FileSystem.setAllocatedCapacity(allocatedCapacity). In the above example, AllocatedCapacity is the key , and its methodName is setAllocatedCapacity. This relation is maintained in FileSystemObjectProperties Enum. Instead, the idea here is to use reflection to invoke the right Method on filesystem Instance, based on the key Provided.