com.google.api.client.util
Class ClassInfo

java.lang.Object
  extended by com.google.api.client.util.ClassInfo

public final class ClassInfo
extends Object

Parses class information to determine data key name/value pairs associated with the class.

Since:
1.0
Author:
Yaniv Inbar

Field Summary
 Class<?> clazz
          Deprecated. (scheduled to be made private in 1.5) Use getUnderlyingClass()
 
Method Summary
static Class<?> getCollectionParameter(Field field)
          Deprecated. (scheduled to be removed in 1.5) use Types.getIterableParameter(Type) on the Field.getGenericType()
 Field getField(String name)
          Returns the field for the given FieldInfo.getName().
 FieldInfo getFieldInfo(String name)
          Returns the information for the given FieldInfo.getName().
 int getKeyCount()
          Deprecated. (scheduled to be removed in 1.5) Use getNames().size()
 Collection<String> getKeyNames()
          Deprecated. (scheduled to be removed in 1.5) Use getNames()
static Class<?> getMapValueParameter(Field field)
          Deprecated. (scheduled to be removed in 1.5) use Types.getMapValueParameter(Type) on the Field.getGenericType()
static Class<?> getMapValueParameter(Type genericType)
          Deprecated. (scheduled to be removed in 1.5) use Types.getMapValueParameter(Type)
 Collection<String> getNames()
          Returns an unmodifiable sorted set (with any possible null member first) of names.
 Class<?> getUnderlyingClass()
          Returns the underlying class.
 boolean isEnum()
          Returns the underlying class is an enum.
static Collection<Object> newCollectionInstance(Class<?> collectionClass)
          Deprecated. (scheduled to be removed in 1.5) use Data.newCollectionInstance(Type)
static
<T> T
newInstance(Class<T> clazz)
          Deprecated. (scheduled to be removed in 1.5) use Types.newInstance(Class)
static Map<String,Object> newMapInstance(Class<?> mapClass)
          Deprecated. (scheduled to be removed in 1.5) use Data.newMapInstance(Class)
static ClassInfo of(Class<?> underlyingClass)
          Returns the class information for the given underlying class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clazz

@Deprecated
public final Class<?> clazz
Deprecated. (scheduled to be made private in 1.5) Use getUnderlyingClass()
Class.

Method Detail

of

public static ClassInfo of(Class<?> underlyingClass)
Returns the class information for the given underlying class.

Parameters:
underlyingClass - underlying class or null for null result
Returns:
class information or null for null input

getUnderlyingClass

public Class<?> getUnderlyingClass()
Returns the underlying class.

Since:
1.4

getFieldInfo

public FieldInfo getFieldInfo(String name)
Returns the information for the given FieldInfo.getName().

Parameters:
name - FieldInfo.getName() or null
Returns:
field information or null for none

getField

public Field getField(String name)
Returns the field for the given FieldInfo.getName().

Parameters:
name - FieldInfo.getName() or null
Returns:
field or null for none

isEnum

public boolean isEnum()
Returns the underlying class is an enum.

Since:
1.4

getKeyCount

@Deprecated
public int getKeyCount()
Deprecated. (scheduled to be removed in 1.5) Use getNames().size()

Returns the number of fields associated with this data class.


getKeyNames

@Deprecated
public Collection<String> getKeyNames()
Deprecated. (scheduled to be removed in 1.5) Use getNames()

Returns the data key names associated with this data class.


getNames

public Collection<String> getNames()
Returns an unmodifiable sorted set (with any possible null member first) of names.


newInstance

@Deprecated
public static <T> T newInstance(Class<T> clazz)
Deprecated. (scheduled to be removed in 1.5) use Types.newInstance(Class)

Creates a new instance of the given class using reflection.


newCollectionInstance

@Deprecated
public static Collection<Object> newCollectionInstance(Class<?> collectionClass)
Deprecated. (scheduled to be removed in 1.5) use Data.newCollectionInstance(Type)

Returns a new instance of the given collection class.

If a concrete collection class in the The class of the returned collection instance depends on the input collection class as follows (first that matches):

Parameters:
collectionClass - collection class or null for ArrayList.
Returns:
new collection instance

newMapInstance

@Deprecated
public static Map<String,Object> newMapInstance(Class<?> mapClass)
Deprecated. (scheduled to be removed in 1.5) use Data.newMapInstance(Class)

Returns a new instance of the given map class.


getCollectionParameter

@Deprecated
public static Class<?> getCollectionParameter(Field field)
Deprecated. (scheduled to be removed in 1.5) use Types.getIterableParameter(Type) on the Field.getGenericType()

Returns the type parameter for the given field assuming it is of type collection.


getMapValueParameter

@Deprecated
public static Class<?> getMapValueParameter(Field field)
Deprecated. (scheduled to be removed in 1.5) use Types.getMapValueParameter(Type) on the Field.getGenericType()

Returns the type parameter for the given field assuming it is of type map.


getMapValueParameter

@Deprecated
public static Class<?> getMapValueParameter(Type genericType)
Deprecated. (scheduled to be removed in 1.5) use Types.getMapValueParameter(Type)

Returns the type parameter for the given genericType assuming it is of type map.



Copyright © 2010-2011 Google. All Rights Reserved.