Class ObjectUtils

java.lang.Object
co.ecg.alpaca.core.framework.ObjectUtils

public class ObjectUtils extends Object

ObjectUtils class.

Version:
$Id: $Id
Author:
mkeathley
  • Constructor Details

    • ObjectUtils

      public ObjectUtils()
  • Method Details

    • flattenObject

      public static List<Object> flattenObject(Object object) throws IllegalAccessException
      Flattens an iterable or map to its component entries or values
      Parameters:
      object - The object to flatted
      Returns:
      A set of objects contained by the object or a set of itself if not an iterable or map
      Throws:
      IllegalAccessException
    • isWrapperType

      public static boolean isWrapperType(Class<?> clazz)
      Returns true if the class is a primitive wrapper type.
      Parameters:
      clazz - The class to check
      Returns:
      True IFF the class is a primitive wrapper
    • getAllInheritedFields

      public static List<Field> getAllInheritedFields(Class<?> type)
      Returns all fields of the class that are declared by the type or any superclass
      Parameters:
      type - The type to traverse
      Returns:
      A List of Fields
    • findObjectRecursively

      public static <T> Map<Class,List<T>> findObjectRecursively(Object object, Class<T> clazzToFind) throws IllegalAccessException
      Returns a list of instances of the Class requested anywhere in the parent objects hierarchy. This does not find instances that are transient, synthetic, static, or final.
      Type Parameters:
      T - The type of the class to find
      Parameters:
      object - The object to traverse
      clazzToFind - The class of instances to find
      Returns:
      A map of Classes in which the object was located and a list of found instances.
      Throws:
      IllegalAccessException - Thrown if a reflection error occurs