public class FieldLiteral<T> extends MemberLiteral<T,Field>
TypeLiteral
Modifier and Type | Method and Description |
---|---|
static <T> FieldLiteral<T> |
get(Field field,
TypeLiteral<T> declaringType)
Returns a new field literal based on the passed field and its declaring
type.
|
TypeLiteral<?> |
getFieldType()
Returns the field's type, if appropriate parametrized with the declaring
class's type parameters.
|
boolean |
isLegacyFinalField()
Returns
true if this is a final field that past versions of Gin
allowed to be set by member injection. |
String |
toString()
Returns the field's declaring type and name in the format used in javadoc,
e.g.
|
getAnnotation, getAnnotations, getBindingAnnotation, getBindingAnnotation, getDeclaringType, getMember, getModifiers, getName, getRawDeclaringType, isAnnotationPresent, isDefaultAccess, isPrivate, isPublic, isStatic
public static <T> FieldLiteral<T> get(Field field, TypeLiteral<T> declaringType)
field
- field for which the literal is createddeclaringType
- the field's declaring typepublic TypeLiteral<?> getFieldType()
public boolean isLegacyFinalField()
true
if this is a final field that past versions of Gin
allowed to be set by member injection.
Past versions of Gin used native Javascript to set the values of inaccessible fields. If those fields also happened to be final, the native code would ignore the final modifier and assign the field anyway.
As I (dburrows) don't feel that this is something to encourage, I'm narrowly allowing this usage only in cases where to do otherwise would break previously compiling code. It might be prudent to remove this exclusion in the future, but not as part of my current work.
Copyright © 2008–2018. All rights reserved.