org.apache.ignite.internal.util

## Class GridReflectionCache

- java.lang.Object
- - org.apache.ignite.internal.util.GridReflectionCache

All Implemented Interfaces:
  Externalizable, Serializable

    public class GridReflectionCache
    extends Object
    implements Externalizable

Reflection field and method cache for classes.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`GridReflectionCache()` Reflection cache without any method or field predicates.
`GridReflectionCache(IgnitePredicate<Field> fp, IgnitePredicate<Method> mp)` Reflection cache with specified field and method predicates.

### Method Summary

Methods
`List<Field>` `fields(Class<?> cls)` Gets fields.
`Field` `firstField(Class<?> cls)` Gets first field in the class list of fields.
`Object` `firstFieldValue(Object o)` Gets field value for object.
`Method` `firstMethod(Class<?> cls)` Gets first method in the class list of methods.
`Object` `firstMethodValue(Object o)` Gets method return value for object.
`List<Method>` `methods(Class<?> cls)` Gets methods.
`void` `readExternal(ObjectInput in)`
`void` `writeExternal(ObjectOutput out)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### GridReflectionCache

    public GridReflectionCache()

Reflection cache without any method or field predicates.

#### GridReflectionCache

    public GridReflectionCache(@Nullable
                       IgnitePredicate<Field> fp,
                       @Nullable
                       IgnitePredicate<Method> mp)

Reflection cache with specified field and method predicates.

Parameters:
  `fp` - Field predicate.
  `mp` - Method predicate.

### Method Detail

#### firstFieldValue

    @Nullable
    public Object firstFieldValue(Object o)
                           throws IgniteCheckedException

Gets field value for object.

Parameters:
  `o` - Key to get affinity key for.
Returns:
  Value of the field for given object or `null` if field was not found.
Throws:
  `IgniteCheckedException` - If failed.

#### firstMethodValue

    @Nullable
    public Object firstMethodValue(Object o)
                            throws IgniteCheckedException

Gets method return value for object.

Parameters:
  `o` - Key to get affinity key for.
Returns:
  Method return value for given object or `null` if method was not found.
Throws:
  `IgniteCheckedException` - If failed.

#### firstField

    @Nullable
    public Field firstField(Class<?> cls)

Gets first field in the class list of fields.

Parameters:
  `cls` - Class.
Returns:
  First field.

#### firstMethod

    @Nullable
    public Method firstMethod(Class<?> cls)

Gets first method in the class list of methods.

Parameters:
  `cls` - Class.
Returns:
  First method.

#### fields

    public List<Field> fields(Class<?> cls)

Gets fields.

Parameters:
  `cls` - Class.
Returns:
  Annotated field.

#### methods

    public List<Method> methods(Class<?> cls)

Gets methods.

Parameters:
  `cls` - Class.
Returns:
  Annotated method.

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.0.0
Release Date | : April 30 2017