/** * A utility method which returns the Class from the given Class name * using the current type context's class loader. * * @param className the class name. * @return a Class object for the named class. */ public static Class getClassFromClassName(String className) { TypeMarshallingContext typeContext = TypeMarshallingContext.getTypeMarshallingContext(); return ClassUtil.createClass(className, typeContext.getClassLoader()); }
/** * A utility method which returns the Class from the given Class name * using the current type context's class loader. * * @param className the class name. * @return a Class object for the named class. */ public static Class getClassFromClassName(String className) { TypeMarshallingContext typeContext = TypeMarshallingContext.getTypeMarshallingContext(); return ClassUtil.createClass(className, typeContext.getClassLoader()); }
/** * A utility method which returns the Class from the given Class name * using the current type context's class loader. * * @param className the class name. * @param createASObjectForMissingType determines whether an ASObject is created * for a type that is not found on the server, instead of throwing an error. * * @return a Class object for the named class. */ public static Class getClassFromClassName(String className, boolean createASObjectForMissingType) { TypeMarshallingContext typeContext = TypeMarshallingContext.getTypeMarshallingContext(); try { return ClassUtil.createClass(className, typeContext.getClassLoader()); } catch (MessageException me) { // Type was not found. if (me.getCode().startsWith(MessageException.CODE_SERVER_RESOURCE_UNAVAILABLE)) { if (createASObjectForMissingType) // Return ASObject instead. return ASObject.class; } throw me; // Rethrow. } }
public Object createShell(Object encodedObject, Class desiredClass) { Object shell = null; Class cls; String type = TypeMarshallingContext.getType(encodedObject); if (type != null) { TypeMarshallingContext context = TypeMarshallingContext.getTypeMarshallingContext(); cls = ClassUtil.createClass(type, context.getClassLoader()); } else { cls = desiredClass; } shell = ClassUtil.createDefaultInstance(cls, null); return shell; }
public Object createShell(Object encodedObject, Class desiredClass) { Object shell = null; Class cls; String type = TypeMarshallingContext.getType(encodedObject); if (type != null) { TypeMarshallingContext context = TypeMarshallingContext.getTypeMarshallingContext(); cls = ClassUtil.createClass(type, context.getClassLoader()); } else { cls = desiredClass; } shell = ClassUtil.createDefaultInstance(cls, null); return shell; }
public Object createShell(Object encodedObject, Class desiredClass) { Object shell = null; Class cls; String type = TypeMarshallingContext.getType(encodedObject); if (type != null) { TypeMarshallingContext context = TypeMarshallingContext.getTypeMarshallingContext(); cls = ClassUtil.createClass(type, context.getClassLoader()); } else { cls = desiredClass; } shell = ClassUtil.createDefaultInstance(cls, null); return shell; }