Package com.spun.util
Class ObjectUtils
java.lang.Object
com.spun.util.ObjectUtils
public class ObjectUtils extends Object
A static class of convenience functions for Manipulating objects
-
Constructor Summary
Constructors Constructor Description ObjectUtils() -
Method Summary
Modifier and Type Method Description static voidassertInstance(Class<?>[] classes, Object object)static voidassertInstance(Class<?> clazz, Object object)static voidassertInstanceOrNull(Class<?> type, Object value)static ThrowablecaptureException(Action0 runnableBlock)static ObjectexecuteMethod(Object object, String method, Class<?>[] methodSignature, Object[] parameters)static intgenerateHashCode(Object... relevantMembers)static StringgetClassName(Object o)static MethodgetGreatestCommonDenominator(Object[] from, String methodName)static Method[]getMethodsForObject(Object o2, String[] passedMethods)static <T> TgetRandomIndex(T[] array)static booleanisClassPresent(String className)static booleanisEqual(Object s1, Object s2)A convenience function to check if 2 strings are equal.static booleanisEqualForMethods(Object o1, Object o2, String... methods)tests if two objects are equal for all functions passed.static booleanisIn(Object target, Object[] objects)static booleanisThisInstanceOfThat(Class<?> thiz, Class<?> that)static Class<?>loadClass(String className)static voidmove(Object from, Object to, String[] getters)static ErrorthrowAsError(Throwable t)static <T> TthrowAsError(Function0WithException<T> code)
-
Constructor Details
-
ObjectUtils
public ObjectUtils()
-
-
Method Details
-
loadClass
- Throws:
ClassNotFoundException
-
generateHashCode
-
isEqualForMethods
tests if two objects are equal for all functions passed. -
getMethodsForObject
public static Method[] getMethodsForObject(Object o2, String[] passedMethods) throws SecurityException, NoSuchMethodException -
isEqual
A convenience function to check if 2 strings are equal. -
isIn
-
isThisInstanceOfThat
-
throwAsError
- Throws:
Error
-
getRandomIndex
public static <T> T getRandomIndex(T[] array) -
getGreatestCommonDenominator
public static Method getGreatestCommonDenominator(Object[] from, String methodName) throws SecurityException, NoSuchMethodException -
executeMethod
-
assertInstance
-
assertInstance
-
getClassName
-
assertInstanceOrNull
-
move
-
isClassPresent
-
captureException
-
throwAsError
-