Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.encog.util.obj
Class ReflectionUtil

    java.lang.Object
      org.encog.util.obj.ReflectionUtil

    public final class ReflectionUtil

extends Object

This class includes some utilities to be used with reflection. This are mostly used by the Encog generic persistence classes.

Method Summary
`static Field` | `findField(Class<?> c, String name)` Find the specified field, look also in superclasses.
`static Collection<Field>` | `getAllFields(Class<?> c)` Get all of the fields from the specified class as a collection.
`static void` | `getAllFields(Class<?> c, Collection<Field> fields)` Get all of the fields in the specified class and super classes.
`static boolean` | `isInstanceOf(Class<?> class1, Class<?> class2)` Determine if one class is an instance of the other class.
`static boolean` | `isPrimitive(Object obj)` Determine if the specified object is a primitive.
`static boolean` | `isSimple(Object obj)` Determine if an object is "simple", that is it should be persisted just with a .tostring.
`static void` | `loadClassmap()` Load the classmap file.
`static void` | `loadStandardClassmap()` Load the classmap file.
`static Class<?>` | `resolveEncogClass(String name)` Resolve an encog class using its simple name.
`static Object` | `resolveEnum(Field field, String value)` Resolve an enumeration.
`static
`<T> int`
` | `safeHashCode(T o)` Generate a hash code for an object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### findField

    public static Field findField(Class<?> c,
                                  String name)

  Find the specified field, look also in superclasses.

  Parameters:
    `c` - The class to search.
    `name` - The name of the field we are looking for.
  Returns:
    The field.

### getAllFields

    public static Collection<Field> getAllFields(Class<?> c)

  Get all of the fields from the specified class as a collection.

  Parameters:
    `c` - The class to access.
  Returns:
    All of the fields from this class and subclasses.

### getAllFields

    public static void getAllFields(Class<?> c,
                                    Collection<Field> fields)

  Get all of the fields in the specified class and super classes.

  Parameters:
    `c` - The class to check.
    `fields` - A collection to hold the classes.

### isInstanceOf

    public static boolean isInstanceOf(Class<?> class1,
                                       Class<?> class2)

  Determine if one class is an instance of the other class.

  Parameters:
    `class1` - The class to check.
    `class2` - Is class1 an instance of class 2.
  Returns:
    True if class 1 is an instance of class 2.

### isPrimitive

    public static boolean isPrimitive(Object obj)

  Determine if the specified object is a primitive.

  Parameters:
    `obj` - The object to check.
  Returns:
    True if this object is primitive.

### isSimple

    public static boolean isSimple(Object obj)

  Determine if an object is "simple", that is it should be persisted just with a .tostring.

  Parameters:
    `obj` - The object to check.
  Returns:
    True if the object is simple.

### loadStandardClassmap

    public static void loadStandardClassmap()

  Load the classmap file. This allows classes to be resolved using just the simple name.

### loadClassmap

    public static void loadClassmap()

  Load the classmap file. This allows classes to be resolved using just the simple name.

### resolveEncogClass

    public static Class<?> resolveEncogClass(String name)

  Resolve an encog class using its simple name.

  Parameters:
    `name` - The simple name of the class.
  Returns:
    The class requested.

### resolveEnum

    public static Object resolveEnum(Field field,
                                     String value)

  Resolve an enumeration.

  Parameters:
    `field` - The field to resolve.
    `value` - The value to get the enum for.
  Returns:
    The enum that was resolved.

### safeHashCode

    public static <T> int safeHashCode(T o)

  Generate a hash code for an object. Return 0 for null objects.

  Type Parameters:
    `T` - The type of object to generate for.
  Parameters:
    `o` - The object to generate.
  Returns:
    The hash code.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.