@Override public void process(Element element, JCodeModel codeModel, EBeanHolder holder) { Classes classes = holder.classes(); String fieldName = element.getSimpleName().toString(); Res resInnerClass = androidValue.getRInnerClass(); JFieldRef idRef = annotationHelper.extractOneAnnotationFieldRef(holder, element, resInnerClass, true); JBlock methodBody = holder.init.body(); TypeMirror fieldTypeMirror = element.asType(); String fieldType = fieldTypeMirror.toString(); // Special case for loading animations if (CanonicalNameConstants.ANIMATION.equals(fieldType)) { methodBody.assign( ref(fieldName), classes.ANIMATION_UTILS.staticInvoke("loadAnimation").arg(holder.contextRef).arg(idRef)); } else { if (holder.resources == null) { holder.resources = methodBody.decl( classes.RESOURCES, "resources_", holder.contextRef.invoke("getResources")); } String resourceMethodName = androidValue.getResourceMethodName(); // Special case for @HtmlRes if (element.getAnnotation(HtmlRes.class) != null) { methodBody.assign( ref(fieldName), classes .HTML .staticInvoke("fromHtml") .arg(invoke(holder.resources, resourceMethodName).arg(idRef))); } else { methodBody.assign(ref(fieldName), invoke(holder.resources, resourceMethodName).arg(idRef)); } } }
@Override public Class<? extends Annotation> getTarget() { return androidValue.getTarget(); }