/** * Get a the named annotation on this field, or null if the field does not have the named annotation. * * @param annotationName * The annotation name. * @return An {@link AnnotationInfo} object representing the named annotation on this field, or null if the * field does not have the named annotation. */ public AnnotationInfo getAnnotationInfo(final String annotationName) { return getAnnotationInfo().get(annotationName); }
/** * Load the class this field is associated with, and get the {@link Field} reference for this field. * * @return The {@link Field} reference for this field. * @throws IllegalArgumentException * if the field does not exist. */ public Field loadClassAndGetField() throws IllegalArgumentException { try { return loadClass().getField(getName()); } catch (final NoSuchFieldException e1) { try { return loadClass().getDeclaredField(getName()); } catch (final NoSuchFieldException e2) { throw new IllegalArgumentException("No such field: " + getClassName() + "." + getName()); } } }
/** Return the names of any classes referenced in the fields in this list. */ void getReferencedClassNames(final Set<String> refdClassNames) { for (final FieldInfo fi : this) { fi.getReferencedClassNames(refdClassNames); } }
/** * Returns the type signature for the field, possibly including type parameters. If the type signature is null, * indicating that no type signature information is available for this field, returns the type descriptor * instead. * * @return The parsed type signature for the field, or if not available, the parsed type descriptor for the * field. */ public TypeSignature getTypeSignatureOrTypeDescriptor() { final TypeSignature typeSig = getTypeSignature(); if (typeSig != null) { return typeSig; } else { return getTypeDescriptor(); } }
buf.append(' '); buf.append(fi.getModifierStr()); buf.append(' '); htmlEncode(fi.getTypeSignatureOrTypeDescriptor().toString(), buf); buf.append("</td>"); final String fieldName = fi.getName(); htmlEncode(fieldName, buf); buf.append("</b></td></tr>");
buf.append(' '); modifiersToString(modifiers, buf); buf.append(' '); buf.append(getTypeSignatureOrTypeDescriptor().toString());
if (fi.getName().equals(fieldName)) { return fi;
/** * @param fieldAnnotationName * The name of a field annotation. * @return true if this class declares a field with the named annotation. */ public boolean hasDeclaredFieldAnnotation(final String fieldAnnotationName) { for (final FieldInfo fieldInfo : getDeclaredFieldInfo()) { if (fieldInfo.hasAnnotation(fieldAnnotationName)) { return true; } } return false; }
if (fieldInfo != null) { for (final FieldInfo fi : fieldInfo) { final TypeSignature fieldSig = fi.getTypeSignatureOrTypeDescriptor(); if (fieldSig != null) { fieldSig.getReferencedClassNames(referencedFieldTypeNames);
classInfoUnlinked.addFieldInfo(new FieldInfo(className, fieldName, fieldModifierFlags, fieldTypeDescriptor, fieldTypeSignature, fieldConstValue, fieldAnnotationInfo));
/** Get the names of any classes in the type descriptor or type signature. */ @Override protected void getReferencedClassNames(final Set<String> classNames) { final TypeSignature methodSig = getTypeSignature(); if (methodSig != null) { methodSig.getReferencedClassNames(classNames); } final TypeSignature methodDesc = getTypeDescriptor(); if (methodDesc != null) { methodDesc.getReferencedClassNames(classNames); } if (annotationInfo != null) { for (final AnnotationInfo annotationInfo : annotationInfo) { annotationInfo.getReferencedClassNames(classNames); } } }
for (final FieldInfo fi : ci.getDeclaredFieldInfo()) { if (fieldNameSet.add(fi.getName())) {
/** * @param annotationName * The name of an annotation. * @return true if this field has the named annotation. */ public boolean hasAnnotation(final String annotationName) { return getAnnotationInfo().containsName(annotationName); }
fi.getReferencedClassNames(classNames);