|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.util.ObjectHelper
public class ObjectHelper
Constructor Summary | |
---|---|
ObjectHelper()
|
Method Summary | |
---|---|
static String |
asString(Object[] objects)
Turns the given object arrays into a meaningful string |
static String |
className(Object value)
Returns the type name of the given value |
static int |
compare(Object a,
Object b)
A helper method for performing an ordered comparsion on the objects handling nulls and objects which do not handle sorting gracefully |
static boolean |
contains(Object collectionOrArray,
Object value)
Returns true if the collection contains the specified value |
static boolean |
equals(Object a,
Object b)
A helper method for comparing objects for equality while handling nulls |
static List<Method> |
findMethodsWithAnnotation(Class<?> type,
Class<? extends Annotation> annotationType)
Returns a list of methods which are annotated with the given annotation |
static String |
getSystemProperty(String name,
String defaultValue)
A helper method to access a system property, catching any security exceptions |
static Object |
invokeMethod(Method method,
Object instance,
Object... parameters)
A helper method to invoke a method via reflection and wrap any exceptions as RuntimeCamelException instances |
static boolean |
isNotNullOrBlank(String text)
|
static Class<?> |
loadClass(String name)
Attempts to load the given class name using the thread context class loader or the class loader used to load this class |
static Class<?> |
loadClass(String name,
ClassLoader loader)
Attempts to load the given class name using the thread context class loader or the given class loader |
static boolean |
matches(List list)
Returns the predicate matching boolean on a List result set
where if the first element is a boolean its value is used
otherwise this method returns true if the collection is not empty |
static String |
name(Class type)
Returns the type name of the given type or null if the type variable is null |
static void |
notNull(Object value,
String name)
|
static String |
removeStartingCharacters(String text,
char ch)
Removes any starting characters on the given text which match the given character |
static String[] |
splitOnCharacter(String value,
String needle,
int count)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectHelper()
Method Detail |
---|
public static boolean equals(Object a, Object b)
public static int compare(Object a, Object b)
public static void notNull(Object value, String name)
public static String[] splitOnCharacter(String value, String needle, int count)
public static String removeStartingCharacters(String text, char ch)
text
- the stringch
- the initial characters to remove
public static boolean contains(Object collectionOrArray, Object value)
public static boolean matches(List list)
List
result set
where if the first element is a boolean its value is used
otherwise this method returns true if the collection is not empty
public static boolean isNotNullOrBlank(String text)
public static String getSystemProperty(String name, String defaultValue)
name
- the name of the system property requireddefaultValue
- the default value to use if the property is not available or a security exception prevents access
public static String name(Class type)
public static String className(Object value)
public static Class<?> loadClass(String name)
name
- the name of the class to load
public static Class<?> loadClass(String name, ClassLoader loader)
name
- the name of the class to loadloader
- the class loader to use after the thread context class loader
public static Object invokeMethod(Method method, Object instance, Object... parameters)
RuntimeCamelException
instances
method
- the method to invokeinstance
- the object instance (or null for static methods)parameters
- the parameters to the method
public static List<Method> findMethodsWithAnnotation(Class<?> type, Class<? extends Annotation> annotationType)
type
- the type to reflect onannotationType
- the annotation type
public static String asString(Object[] objects)
objects
- an array of objects or null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |