org.apache.ignite.internal.util.gridify

## Class GridifyUtils

- java.lang.Object
- - org.apache.ignite.internal.util.gridify.GridifyUtils

    public final class GridifyUtils
    extends Object

Utility class with common methods used in gridify annotations.

### Field Summary

Fields
`static int` `UNKNOWN_SIZE`

### Method Summary

Methods
`static Object` `collectionToParameter(Class<?> paramCls, Collection data)` Converts `Collection` back to object applied for method.
`static Collection<String>` `getAllowedMethodParameterTypes()` Allowed method return types.
`static List<String>` `getAllowedMethodReturnTypes()` Allowed method return types.
`static Iterator<?>` `getIterator(Object obj)` Gets iterator or create new for container object with elements with unknown type.
`static int` `getLength(Object obj)` Gets length of elements in container object with unknown type.
`static boolean` `isMethodParameterTypeAllowed(Class<?> cls)` Check if method parameter type type can be used for `GridifySetToSet` or `GridifySetToValue` annotations.
`static boolean` `isMethodParameterTypeAnnotated(Annotation[] anns)` Check is method parameter annotated with `GridifyInput`.
`static boolean` `isMethodReturnTypeValid(Class<?> cls)` Check if method return type can be used for `GridifySetToSet` or `GridifySetToValue` annotations.
`static Collection` `parameterToCollection(Object arg)` Converts parameter object to `Collection`.

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

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

### Field Detail

#### UNKNOWN_SIZE

    public static final int UNKNOWN_SIZE

See Also:
  Constant Field Values

### Method Detail

#### getLength

    public static int getLength(Object obj)

Gets length of elements in container object with unknown type. There is no ability to get size of elements for some object types and method returns `UNKNOWN_SIZE` value.

Parameters:
  `obj` - Container object with elements.
Returns:
  Elements size of `UNKNOWN_SIZE`.

#### getIterator

    public static Iterator<?> getIterator(Object obj)

Gets iterator or create new for container object with elements with unknown type.

Parameters:
  `obj` - Container object with elements.
Returns:
  Iterator.

#### isMethodReturnTypeValid

    public static boolean isMethodReturnTypeValid(Class<?> cls)

Check if method return type can be used for `GridifySetToSet` or `GridifySetToValue` annotations.

Parameters:
  `cls` - Method return type class to check.
Returns:
  `true` if method return type is valid.

#### isMethodParameterTypeAllowed

    public static boolean isMethodParameterTypeAllowed(Class<?> cls)

Check if method parameter type type can be used for `GridifySetToSet` or `GridifySetToValue` annotations.

Parameters:
  `cls` - Method parameter to check.
Returns:
  `true` if method parameter type is valid.

#### isMethodParameterTypeAnnotated

    public static boolean isMethodParameterTypeAnnotated(Annotation[] anns)

Check is method parameter annotated with `GridifyInput`.

Parameters:
  `anns` - Annotations for method parameters.
Returns:
  `true` if annotation found.

#### getAllowedMethodReturnTypes

    public static List<String> getAllowedMethodReturnTypes()

Allowed method return types.

Returns:
  List of class names or text comments.

#### getAllowedMethodParameterTypes

    public static Collection<String> getAllowedMethodParameterTypes()

Allowed method return types.

Returns:
  List of class names or text comments.

#### parameterToCollection

    @Nullable
    public static Collection parameterToCollection(Object arg)

Converts parameter object to `Collection`.

Parameters:
  `arg` - Method parameter object.
Returns:
  Collection of parameters or `null` for unknown object.

#### collectionToParameter

    @Nullable
    public static Object collectionToParameter(Class<?> paramCls,
                                        Collection data)

Converts `Collection` back to object applied for method.

Parameters:
  `paramCls` - Method parameter type.
  `data` - Collection of data elements.
Returns:
  Object applied for method.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.4.0
Release Date | : September 24 2015