MCPcopy
hub / github.com/libgdx/libgdx / Field

Class Field

backends/gdx-backends-gwt/src/com/badlogic/gwtref/client/Field.java:22–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20import java.util.Arrays;
21
22public class Field {
23 final String name;
24 final CachedTypeLookup enclosingType;
25 final CachedTypeLookup type;
26 final boolean isFinal;
27 final boolean isDefaultAccess;
28 final boolean isPrivate;
29 final boolean isProtected;
30 final boolean isPublic;
31 final boolean isStatic;
32 final boolean isTransient;
33 final boolean isVolatile;
34 final int getter;
35 final int setter;
36 final CachedTypeLookup[] elementTypes;
37 final Annotation[] annotations;
38
39 Field (String name, Class enclosingType, Class type, boolean isFinal, boolean isDefaultAccess, boolean isPrivate,
40 boolean isProtected, boolean isPublic, boolean isStatic, boolean isTransient, boolean isVolatile, int getter, int setter,
41 Class[] elementTypes, Annotation[] annotations) {
42 this.name = name;
43 this.enclosingType = new CachedTypeLookup(enclosingType);
44 this.type = new CachedTypeLookup(type);
45 this.isFinal = isFinal;
46 this.isDefaultAccess = isDefaultAccess;
47 this.isPrivate = isPrivate;
48 this.isProtected = isProtected;
49 this.isPublic = isPublic;
50 this.isStatic = isStatic;
51 this.isTransient = isTransient;
52 this.isVolatile = isVolatile;
53 this.getter = getter;
54 this.setter = setter;
55
56 CachedTypeLookup[] tmp = null;
57 if (elementTypes != null) {
58 tmp = new CachedTypeLookup[elementTypes.length];
59 for (int i = 0; i < tmp.length; i++) {
60 tmp[i] = new CachedTypeLookup(elementTypes[i]);
61 }
62 }
63 this.elementTypes = tmp;
64
65 this.annotations = annotations != null ? annotations : new Annotation[] {};
66 }
67
68 public Object get (Object obj) throws IllegalAccessException {
69 return ReflectionCache.getFieldValue(this, obj);
70 }
71
72 public void set (Object obj, Object value) throws IllegalAccessException {
73 ReflectionCache.setFieldValue(this, obj, value);
74 }
75
76 public Type getElementType (int index) {
77 if (elementTypes != null && index >= 0 && index < elementTypes.length) return elementTypes[index].getType();
78 return null;
79 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected