Package org.apache.myfaces.util.lang
Class ClassUtils
java.lang.Object
org.apache.myfaces.core.api.shared.lang.ClassUtils
org.apache.myfaces.util.lang.ClassUtils
- 
Field SummaryFields inherited from class org.apache.myfaces.core.api.shared.lang.ClassUtilsBOOLEAN_ARRAY_CLASS, BOOLEAN_OBJECT_ARRAY_CLASS, BYTE_ARRAY_CLASS, BYTE_OBJECT_ARRAY_CLASS, CHAR_ARRAY_CLASS, CHARACTER_OBJECT_ARRAY_CLASS, COMMON_TYPES, DOUBLE_ARRAY_CLASS, DOUBLE_OBJECT_ARRAY_CLASS, EMPTY_STRING, FLOAT_ARRAY_CLASS, FLOAT_OBJECT_ARRAY_CLASS, INT_ARRAY_CLASS, INTEGER_OBJECT_ARRAY_CLASS, LONG_ARRAY_CLASS, LONG_OBJECT_ARRAY_CLASS, OBJECT_ARRAY_CLASS, PRIMITIVE_NAMES, PRIMITIVES, SHORT_ARRAY_CLASS, SHORT_OBJECT_ARRAY_CLASS, STRING_OBJECT_ARRAY_CLASS
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> TbuildApplicationObject(Class<T> interfaceClass, Class<? extends T> extendedInterfaceClass, Class<? extends T> extendedInterfaceWrapperClass, Collection<String> classNamesIterator, T defaultObject) Creates ApplicationObjects like NavigationHandler or StateManager and creates the right wrapping chain of the ApplicationObjects known as the decorator pattern.static <T> TbuildApplicationObject(Class<T> interfaceClass, Collection<String> classNamesIterator, T defaultObject) Creates ApplicationObjects like NavigationHandler or StateManager and creates the right wrapping chain of the ApplicationObjects known as the decorator pattern.static <T> Class<T>classForName(String type) Tries a Class.loadClass with the context class loader of the current thread first and automatically falls back to the ClassUtils class loader (i.e.static URLgetResource(String resource) static InputStreamgetResourceAsStream(String resource) protected static final StringparamString(Class<?>... types) static ClasssimpleClassForName(String type) Same asclassForName(String), but throws a RuntimeException (FacesException) instead of a ClassNotFoundException.static ClasssimpleClassForName(String type, boolean logAndThrowException) Same as {linksimpleClassForName(String), but will only log the exception and rethrow a RunTimeException if logAndThrowException is true.static ClasssimpleClassForName(String type, boolean throwException, boolean logException) Same as {linksimpleClassForName(String), but accepts two booleans One to log an exception and another to rethrow a FacesExceptionsstatic <T> TwrapBackwardCompatible(Class<T> interfaceClass, Class<? extends T> extendedInterfaceClass, Class<? extends T> extendedInterfaceWrapperClass, T defaultObject, T newCurrent) Wrap an object using a backwards compatible wrapper if availableMethods inherited from class org.apache.myfaces.core.api.shared.lang.ClassUtilsconvertToType, convertToTypeNoLogging, forName, forNamePrimitive, getContextClassLoader, getCurrentLoader, getCurrentLoader, getResources, javaDefaultTypeToClass, javaTypeToClass, newInstance, newInstance, newInstance, newInstance, newInstance, simpleJavaTypeToClass, toTypeArray, toTypeNameArray
- 
Constructor Details- 
ClassUtilspublic ClassUtils()
 
- 
- 
Method Details- 
buildApplicationObjectpublic static <T> T buildApplicationObject(Class<T> interfaceClass, Collection<String> classNamesIterator, T defaultObject) Creates ApplicationObjects like NavigationHandler or StateManager and creates the right wrapping chain of the ApplicationObjects known as the decorator pattern.- Type Parameters:
- T-
- Parameters:
- interfaceClass- The class from which the implementation has to inherit from.
- classNamesIterator- All the class names of the actual ApplicationObject implementations from the faces-config.xml.
- defaultObject- The default implementation for the given ApplicationObject.
- Returns:
 
- 
buildApplicationObjectpublic static <T> T buildApplicationObject(Class<T> interfaceClass, Class<? extends T> extendedInterfaceClass, Class<? extends T> extendedInterfaceWrapperClass, Collection<String> classNamesIterator, T defaultObject) Creates ApplicationObjects like NavigationHandler or StateManager and creates the right wrapping chain of the ApplicationObjects known as the decorator pattern.- Type Parameters:
- T-
- Parameters:
- interfaceClass- The class from which the implementation has to inherit from.
- extendedInterfaceClass- A subclass of interfaceClass which specifies a more detailed implementation.
- extendedInterfaceWrapperClass- A wrapper class for the case that you have an ApplicationObject which only implements the interfaceClass but not the extendedInterfaceClass.
- classNamesIterator- All the class names of the actual ApplicationObject implementations from the faces-config.xml.
- defaultObject- The default implementation for the given ApplicationObject.
- Returns:
 
- 
wrapBackwardCompatiblepublic static <T> T wrapBackwardCompatible(Class<T> interfaceClass, Class<? extends T> extendedInterfaceClass, Class<? extends T> extendedInterfaceWrapperClass, T defaultObject, T newCurrent) Wrap an object using a backwards compatible wrapper if available- Parameters:
- interfaceClass- The class from which the implementation has to inherit from.
- extendedInterfaceClass- A subclass of interfaceClass which specifies a more detailed implementation.
- extendedInterfaceWrapperClass- A wrapper class for the case that you have an ApplicationObject which only implements the interfaceClass but not the extendedInterfaceClass.
- defaultObject- The default implementation for the given ApplicationObject.
- newCurrent- The new current object
- Returns:
 
- 
classForNameTries a Class.loadClass with the context class loader of the current thread first and automatically falls back to the ClassUtils class loader (i.e. the loader of the myfaces.jar lib) if necessary.- Parameters:
- type- fully qualified name of a non-primitive non-array class
- Returns:
- the corresponding Class
- Throws:
- NullPointerException- if type is null
- ClassNotFoundException
 
- 
simpleClassForNameSame asclassForName(String), but throws a RuntimeException (FacesException) instead of a ClassNotFoundException.- Returns:
- the corresponding Class
- Throws:
- NullPointerException- if type is null
- FacesException- if class not found
 
- 
simpleClassForNameSame as {linksimpleClassForName(String), but will only log the exception and rethrow a RunTimeException if logAndThrowException is true.- Parameters:
- type-
- logAndThrowException- - true to log and throw FacesException, false to avoid logging and throwing the FacesException
- Returns:
- the corresponding Class
- Throws:
- FacesException- if class not found and logAndThrowException is true
 
- 
simpleClassForNameSame as {linksimpleClassForName(String), but accepts two booleans One to log an exception and another to rethrow a FacesExceptions- Parameters:
- type-
- logException- - true to log the ClassNotFoundException, false to avoid logging
- throwException- - true to throw a FacesException, false to avoid throwing a FacesException
- Returns:
- the corresponding Class
- Throws:
- FacesException- if class not found and throwException is true
 
- 
getResource
- 
getResourceAsStream
- 
paramString
 
-