Package org.ofbiz.core.util
Class ObjectType
java.lang.Object
org.ofbiz.core.util.ObjectType
Utilities for analyzing and converting Object types in Java - takes advantage of a lot of reflection and other stuff
- Since:
- 2.0
- Version:
- $Revision: 1.1 $
- Author:
- Andy Zeneski, David E. Jones, Rene Gielen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BooleandoRealCompare(Object value1, Object value2, String operator, String type, String format, List<String> messages, Locale locale, ClassLoader loader) static ObjectgetInstance(String className) Returns an instance of the specified classstatic booleaninstanceOf(Object obj, Class<?> typeClass) Tests if an object is an instance of a sub-class of or properly implements an interfacestatic booleaninstanceOf(Object obj, Object typeObject) Tests if an object is an instance of a sub-class of or properly implements an interfacestatic booleaninstanceOf(Object obj, String typeName) Tests if an object is an instance of a sub-class of or properly implements an interfacestatic booleaninstanceOf(Object obj, String typeName, ClassLoader loader) Tests if an object is an instance of a sub-class of or properly implements an interfacestatic booleaninterfaceOf(Object obj, Class<?> interfaceClass) Tests if an object properly implements the specified interfacestatic booleaninterfaceOf(Object obj, Object interfaceObject) Tests if an object properly implements the specified interfacestatic booleaninterfaceOf(Object obj, String interfaceName) Tests if an object properly implements the specified interfacestatic booleanTests if an object is an instance of or a sub-class of the parentstatic booleanTests if an object is an instance of or a sub-class of the parentstatic booleanTests if an object is an instance of or a sub-class of the parentstatic Class<?>Loads a class with the current thread's context classloaderstatic Class<?>loadClass(String className, ClassLoader loader) Loads a class with the current thread's context classloaderstatic ObjectsimpleTypeConvert(Object obj, String type, String format, Locale locale) Converts the passed object to the named simple type; supported types include: String, Boolean, Double, Float, Long, Integer, Date (java.sql.Date), Time, Timestamp;
-
Field Details
-
module
-
classCache
-
LANG_PACKAGE
- See Also:
-
SQL_PACKAGE
- See Also:
-
-
Constructor Details
-
ObjectType
public ObjectType()
-
-
Method Details
-
loadClass
Loads a class with the current thread's context classloader- Parameters:
className- The name of the class to load- Throws:
ClassNotFoundException
-
loadClass
public static Class<?> loadClass(String className, ClassLoader loader) throws ClassNotFoundException Loads a class with the current thread's context classloader- Parameters:
className- The name of the class to load- Throws:
ClassNotFoundException
-
getInstance
public static Object getInstance(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException Returns an instance of the specified class- Parameters:
className- Name of the class to instantiate- Throws:
ClassNotFoundExceptionInstantiationExceptionIllegalAccessException
-
interfaceOf
Tests if an object properly implements the specified interface- Parameters:
obj- Object to testinterfaceName- Name of the interface to test against- Throws:
ClassNotFoundException
-
interfaceOf
Tests if an object properly implements the specified interface- Parameters:
obj- Object to testinterfaceObject- to test against
-
interfaceOf
Tests if an object properly implements the specified interface- Parameters:
obj- Object to testinterfaceClass- Class to test against
-
isOrSubOf
Tests if an object is an instance of or a sub-class of the parent- Parameters:
obj- Object to testparentName- Name of the parent class to test against- Throws:
ClassNotFoundException
-
isOrSubOf
Tests if an object is an instance of or a sub-class of the parent- Parameters:
obj- Object to testparentObject- Object to test against
-
isOrSubOf
Tests if an object is an instance of or a sub-class of the parent- Parameters:
obj- Object to testparentClass- Class to test against
-
instanceOf
Tests if an object is an instance of a sub-class of or properly implements an interface- Parameters:
obj- Object to testtypeObject- Object to test against
-
instanceOf
Tests if an object is an instance of a sub-class of or properly implements an interface- Parameters:
obj- Object to testtypeName- Type Name to test against
-
instanceOf
Tests if an object is an instance of a sub-class of or properly implements an interface- Parameters:
obj- Object to testtypeName- Type Name to test against
-
instanceOf
Tests if an object is an instance of a sub-class of or properly implements an interface- Parameters:
obj- Object to testtypeClass- Class to test against
-
simpleTypeConvert
public static Object simpleTypeConvert(Object obj, String type, String format, Locale locale) throws GeneralException Converts the passed object to the named simple type; supported types include: String, Boolean, Double, Float, Long, Integer, Date (java.sql.Date), Time, Timestamp;- Parameters:
obj- Object to converttype- Name of type to convert toformat- Optional (can be null) format string for Date, Time, Timestamplocale- Optional (can be null) Locale for formatting and parsing Double, Float, Long, Integer- Throws:
GeneralException
-
doRealCompare
-