Errai 3.0.1-SNAPSHOT

org.jboss.errai.codegen.meta
Class MetaField

java.lang.Object
  extended by org.jboss.errai.codegen.meta.MetaField
All Implemented Interfaces:
HasAnnotations, MetaClassMember
Direct Known Subclasses:
BuildMetaField, GWTField, JavaReflectionField, MetaField.ArrayLengthMetaField

public abstract class MetaField
extends Object
implements HasAnnotations, MetaClassMember


Nested Class Summary
static class MetaField.ArrayLengthMetaField
          Special-purpose implementation of MetaField that represents the length property of an array.
 
Constructor Summary
MetaField()
           
 
Method Summary
 Field asField()
          Returns the java.lang.reflect.Field object representing this MetaField.
 boolean equals(Object o)
          Compares this MetaField with another MetaField.
abstract  Annotation[] getAnnotations()
          Returns the annotations present on this field.
abstract  MetaType getGenericType()
          Returns the actual unerased type of this field, which could be a MetaClass (class, enum, interface, array, primitive, etc), a bounded or unbounded type variable, or a wildcard.
abstract  String getName()
          Returns this field's name without any type information or qualifiers.
abstract  MetaClass getType()
          Returns an actual MetaClass (a class, interface, primitive type, array, or enum, but not a type variable or a wildcard) representing an erased type that is assignable to this field.
 int hashCode()
           
 String hashString()
          Returns a string that uniquely identifies this field for purposes of comparison with other implementations of MetaField.ArrayLengthMetaField.
 String toString()
          Returns a string which includes the declaring class's name and the field name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.errai.codegen.meta.MetaClassMember
getDeclaringClass, isAbstract, isFinal, isPrivate, isProtected, isPublic, isStatic, isSynchronized, isSynthetic, isTransient, isVolatile
 
Methods inherited from interface org.jboss.errai.codegen.meta.HasAnnotations
getAnnotation, isAnnotationPresent
 

Constructor Detail

MetaField

public MetaField()
Method Detail

getType

public abstract MetaClass getType()
Returns an actual MetaClass (a class, interface, primitive type, array, or enum, but not a type variable or a wildcard) representing an erased type that is assignable to this field.

Returns:
a MetaClass representing a type that is assignable to this field. Never null.
See Also:
getGenericType()

getGenericType

public abstract MetaType getGenericType()
Returns the actual unerased type of this field, which could be a MetaClass (class, enum, interface, array, primitive, etc), a bounded or unbounded type variable, or a wildcard. Unlike with getType(), any type parameters on the field's type will be preserved in the returned MetaType object.

Returns:
The field type as declared. Never null.

getName

public abstract String getName()
Returns this field's name without any type information or qualifiers.

Specified by:
getName in interface MetaClassMember
Returns:
The field name. Never null.

getAnnotations

public abstract Annotation[] getAnnotations()
Returns the annotations present on this field.

Specified by:
getAnnotations in interface HasAnnotations
Returns:
A shared reference to the array of the annotations on this field. Returns an empty array (never null) if the field has no annotations. Callers should refrain from modifying the returned array.

toString

public String toString()
Returns a string which includes the declaring class's name and the field name. Do not rely on the format of this string remaining consistent across releases of Errai.

Overrides:
toString in class Object

hashString

public String hashString()
Returns a string that uniquely identifies this field for purposes of comparison with other implementations of MetaField.ArrayLengthMetaField. The returned string includes the declaring class name, the field name, and the field's type.

Returns:

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Compares this MetaField with another MetaField. Differing implenentations (for example, GWT vs Java Reflection) compare equal as long as they represent the same field of the same class.

Overrides:
equals in class Object

asField

public Field asField()
Returns the java.lang.reflect.Field object representing this MetaField.

Returns:
The Java Reflection Field object representing the same field as this MetaField. Never null.
Throws:
IllegalStateException - if the field or its containing class cannot be located using Java Reflection.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.