Return an instance of the annotation type fields builder for the given
class.

@return an instance of the annotation type field builder for the given
annotation type.
178635
public AbstractBuilder getAnnotationTypeFieldsBuilder(
            AnnotationTypeWriter annotationTypeWriter)
    throws Exception {
        return AnnotationTypeFieldBuilder.getInstance(context,
            annotationTypeWriter.getAnnotationTypeDoc(),
            writerFactory.getAnnotationTypeFieldWriter(
                annotationTypeWriter));
    }
904648
public static AnnotationUtilImpl getInstance() {

    if (instance == null) {
      synchronized (AnnotationUtilImpl.class) {
        if (instance == null) {
          AnnotationUtilImpl util = new AnnotationUtilImpl();
          util.setReflectionUtil(ReflectionUtilImpl.getInstance());
          instance = util;
        }
      }
    }
    return instance;
  }
832282
public static Type getPropertyType(Class<?> beanClass, String field) {
		return INSTANCE.findPropertyType(beanClass, field);
	}
285999
public AnnotationValueBuilder<T> member(String name, @Nullable Class<?> type) {
        if (type != null) {
            values.put(name, new AnnotationClassValue<>(type));
        }
        return this;
    }
467971
@SuppressWarnings("unchecked")
	public <A extends Annotation> A getAnnotation(Class<A> type) {
		for (Annotation annotation : this.annotations) {
			if (type.isInstance(annotation)) {
				return (A) annotation;
			}
		}
		return null;
	}
978451
public T annotationType(@NonNull AnnotationType annotationType) {
      this.annotationType.add(annotationType);
      return Cast.as(this);
   }
1146614
public static AnnotationTypeFieldBuilder getInstance(
            Context context, TypeElement typeElement,
            AnnotationTypeFieldWriter writer) {
        return new AnnotationTypeFieldBuilder(context, typeElement,
                    writer, VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS);
    }
815634
public AnnotationValueBuilder<T> member(String name, @Nullable Class<?>... types) {
        if (types != null) {
            AnnotationClassValue[] classValues = new AnnotationClassValue[types.length];
            for (int i = 0; i < types.length; i++) {
                Class<?> type = types[i];
                classValues[i] = new AnnotationClassValue<>(type);
            }
            values.put(name, classValues);
        }
        return this;
    }
853945
public static FieldAnnotation fromBCELField(JavaClass jClass, Field field) {
        return new FieldAnnotation(jClass.getClassName(), field.getName(), field.getSignature(), field.isStatic());
    }
822572
public <T> T getAnnotation(Class<T> annotationClass) {
        for (Annotation annotation : m_annotations) {
            if (annotation.annotationType().equals(annotationClass)){
                return (T) annotation;
            }
        }
        return null;
    }
1218384
public static AnnotationTypeFieldBuilder getInstance(
            Context context, ClassDoc classDoc,
            AnnotationTypeFieldWriter writer) {
        return new AnnotationTypeFieldBuilder(context, classDoc,
                    writer, VisibleMemberMap.ANNOTATION_TYPE_FIELDS);
    }
282929
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
        T result = null;
        if (field != null) {
            result = field.getAnnotation(annotationClass);
        }
        if (result == null && setter != null) {
            result = setter.getAnnotation(annotationClass);
        }
        if (result == null && getter != null) {
            result = getter.getAnnotation(annotationClass);
        }
        return result;
    }
3782
public <T extends Annotation> boolean isAnnotationPresentOnField( Class<T> annotation ) {
        return CreatorUtils.isAnnotationPresent( annotation, fields );
    }
1148870
private String generateSerdesClassAndField(TreeLogger logger, TypeOracle oracle, SourceWriter w,
                                               JClassType type, Json annotation) {
        final String qualifiedSourceName = type.getQualifiedSourceName();
        final String fieldName = getFieldName(type);
        final String listWrapperTypeName = getListWrapperTypeName(type);
        final String setWrapperTypeName = getSetWrapperTypeName(type);
        final String listWrapperFactoryMethodName = factoryFieldName + "." + firstCharToLowerCase(listWrapperTypeName);
        final String setWrapperFactoryMethodName = factoryFieldName + "." + firstCharToLowerCase(setWrapperTypeName);

        final String serdesFieldName = fieldName + "Serdes";
        final String serdesTypeName = getTypeName(type) + "Serdes";

        // serializer field as anonymous class
        w.println("private static class %s extends JsonObjectSerdes<%s> implements HasImpl {", serdesTypeName,
                qualifiedSourceName);

        // static field for impl array
        final String autoBeanInstanceClass = factoryFieldName + "." + fieldName + "().getClass()";
        w.println("    private final Class[] IMPL = new Class[]{ %s };", autoBeanInstanceClass);

        // static field to content-types
        w.println("    private final String[] PATTERNS = new String[]{ %s };", asStringCsv(annotation.value()));
        w.println();

        // constructor
        w.println("    public %s() {", serdesTypeName);
        w.println("        super(%s.class);", qualifiedSourceName);
        w.println("    }");
        w.println();

        // mediaType
        w.println("    @Override");
        w.println("    public Class[] implTypes() {");
        w.println("        return IMPL;");
        w.println("    }");
        w.println();

        // mediaType
        w.println("    @Override");
        w.println("    public String[] mediaType() {");
        w.println("        return PATTERNS;");
        w.println("    }");
        w.println();

        // readJson - used when any of deserialize alternatives succeeded (see JsonObjectSerdes)
        // TODO: improve this by not requiring parsing the json to an js array and latter stringifying it (see below)
        // Here would be no-op
        w.println("    @Override");
        w.println("    public %s readJson(JsonRecordReader r, DeserializationContext ctx) {",
                qualifiedSourceName);
        w.println("        return AutoBeanCodex.decode(%s, %s.class, JsonObjectSerdes.stringify(r)).as();",
                factoryFieldName, qualifiedSourceName);
        w.println("    }");
        w.println();

        // writeJson - not used
        w.println("    @Override");
        w.println("    public void writeJson(%s o, JsonRecordWriter w, SerializationContext ctx) {",
                qualifiedSourceName);
        w.println("        return;");
        w.println("    }");
        w.println();

        // deserialize - deserialize single object using ObjectMapper
        w.println("    @Override");
        w.println("    public %s deserialize(String s, DeserializationContext ctx) {", qualifiedSourceName);
        w.println("        try {");
        w.println("            return AutoBeanCodex.decode(%s, %s.class, s).as();", factoryFieldName,
                qualifiedSourceName);
        w.println("        } catch (java.lang.Exception e) {");
        w.println("            throw new UnableToDeserializeException(\"The auto-generated AutoBean deserializer" +
                " failed to deserialize the response body to \" + ctx.getRequestedType().getName() + \".\", e);");
        w.println("        }");
        w.println("    }");
        w.println();

        // deserialize
        w.println("    @Override");
        w.println("    public <C extends Collection<%s>> C deserialize(Class<C> c, " +
                "String s, DeserializationContext ctx) {", qualifiedSourceName);
        w.println("        try {");
        w.println("            if (c == List.class || c == Collection.class)");
        w.println("                return (C) AutoBeanCodex.decode(%s, %s.class, " +
                "\"{\\\"result\\\":\" + s + \"}\").as().getResult();", factoryFieldName, listWrapperTypeName);
        w.println("            else if (c == Set.class)");
        w.println("                return (C) AutoBeanCodex.decode(%s, %s.class, " +
                "\"{\\\"result\\\":\" + s + \"}\").as().getResult();", factoryFieldName, setWrapperTypeName);
        w.println("            else");
        // TODO: improve this by not requiring parsing the json to an js array and latter stringifying it
        // An alternative would be manually traverse the json array and passing each json object to serialize method
        w.println("                return super.deserialize(c, s, ctx);");
        w.println("        } catch (java.lang.Exception e) {");
        w.println("            throw new UnableToDeserializeException(\"The auto-generated AutoBean deserializer" +
                " failed to deserialize the response body" +
                " to \" + c.getName() + \"<\" + ctx.getRequestedType().getName() + \">.\", e);");
        w.println("        }");
        w.println("    }");

        // serialize
        w.println("    @Override");
        w.println("    public String serialize(%s o, SerializationContext ctx) {", qualifiedSourceName);
        w.println("        try {");
        w.println("            return AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(o)).getPayload();");
        w.println("        } catch (java.lang.Exception e) {");
        w.println("            throw new UnableToSerializeException(\"The auto-generated AutoBean serializer" +
                " failed to serialize the instance of \" + o.getClass().getName() + \" to JSON.\", e);");
        w.println("        }");
        w.println("    }");
        w.println();

        // serialize
        w.println("    @Override");
        w.println("    public String serialize(Collection<%s> c, SerializationContext ctx) {",
                qualifiedSourceName);
        w.println("        try {");
        w.println("            if (c instanceof List) {");
        w.println("                final AutoBean<%s> autoBean = %s();", listWrapperTypeName,
                listWrapperFactoryMethodName);
        w.println("                autoBean.as().setResult((List) c);");
        w.println("                final String json = AutoBeanCodex.encode(autoBean).getPayload();");
        w.println("                return json.substring(10, json.length() -1);");
        w.println("            }");
        w.println("            if (c instanceof Set) {");
        w.println("                final AutoBean<%s> autoBean = %s();", setWrapperTypeName,
                setWrapperFactoryMethodName);
        w.println("                autoBean.as().setResult((Set) c);");
        w.println("                final String json = AutoBeanCodex.encode(autoBean).getPayload();");
        w.println("                return json.substring(10, json.length() -1);");
        w.println("            }");
        w.println("            return super.serialize(c, ctx);");
        w.println("        } catch (java.lang.Exception e) {");
        w.println("            throw new UnableToSerializeException(\"The auto-generated AutoBean serializer" +
                " failed to serialize the instance of \" + c.getClass().getName() + \" to JSON.\", e);");
        w.println("        }");
        w.println("    }");

        // end anonymous class
        w.println("};");
        w.println();

        // serializer field as anonymous class
        w.println("private final %s %s = new %s();", serdesTypeName, serdesFieldName, serdesTypeName);
        w.println();

        return serdesFieldName;
    }
305374
public AbstractBuilder getFieldBuilder(ClassWriter classWriter)
            throws Exception {
        return FieldBuilder.getInstance(context, classWriter.getClassDoc(),
            writerFactory.getFieldWriter(classWriter));
    }
1353176
public FieldType<BeanType<T>> getOrCreateField()
   {
      List<Node> nodeList = childNode.get("field");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new FieldTypeImpl<BeanType<T>>(this, "field", childNode, nodeList.get(0));
      }
      return createField();
   }
689472
@SuppressWarnings("unchecked")
    public <A extends Annotation> A getAnnotation(final Field field, final Class<A> annClass) throws AnnotationReadException {
        
        final Class<?> clazz = field.getDeclaringClass();
        
        if(xmlInfo != null && xmlInfo.containsClassInfo(clazz.getName())) {
            final ClassInfo classInfo = xmlInfo.getClassInfo(clazz.getName());
            
            if(classInfo.containsFieldInfo(field.getName())) {
                FieldInfo fieldInfo = classInfo.getFieldInfo(field.getName());
                if(fieldInfo != null && fieldInfo.containsAnnotationInfo(annClass.getName())){
                    AnnotationInfo annInfo = fieldInfo.getAnnotationInfo(annClass.getName());
                    try {
                        return (A)annotationBuilder.buildAnnotation(Class.forName(annInfo.getClassName()), annInfo);
                    } catch (ClassNotFoundException e) {
                        throw new AnnotationReadException(String.format("not found class '%s'", annInfo.getClassName()), e);
                    }
                }
            }
        }
        return field.getAnnotation(annClass);
    }