public static Element getField(ExecutableElement method) { return getField(method.getEnclosingElement(), toField(method)); }
public static VariableElement getField(Element element, String name) { List<VariableElement> fields = ElementFilter.fieldsIn(element.getEnclosedElements()); for (VariableElement field: fields) { if (field.getSimpleName().toString().equals(name)) { return field; } } if (element.getKind().equals(ElementKind.CLASS)) { TypeMirror superclass = ((TypeElement)element).getSuperclass(); if (superclass.getKind().equals(TypeKind.DECLARED)) { return getField(((DeclaredType)superclass).asElement(), name); } } return null; }
protected List<AnnotationMirror> getSupportedAnnotations(TransferObjectContext context) { if (typeCopyAccessor == null) { typeCopyAccessor = new CopyAccessor(context.getConfigurationTypeElement().asConfigurationElement(), processingEnv); } CopyAccessor methodCopyAccessor = new CopyAccessor(context.getDtoMethod(), processingEnv); List<AnnotationMirror> supportedAnnotations = new ArrayList<AnnotationMirror>(); if (context.getDomainMethod() != null) { add(supportedAnnotations, methodCopyAccessor.getSupportedAnnotations(context.getInstantiableDomainMethod())); add(supportedAnnotations, methodCopyAccessor.getSupportedAnnotations(MethodHelper.getField(context.getDomainMethod()))); } add(supportedAnnotations, methodCopyAccessor.getSupportedAnnotations(context.getDtoMethod())); if (context.getDomainMethod() != null) { add(supportedAnnotations, typeCopyAccessor.getSupportedAnnotations(context.getInstantiableDomainMethod())); add(supportedAnnotations, typeCopyAccessor.getSupportedAnnotations(MethodHelper.getField(context.getDomainMethod()))); } add(supportedAnnotations, typeCopyAccessor.getSupportedAnnotations(context.getDtoMethod())); return supportedAnnotations; }
ExecutableElement domainGetterMethod = instantiableDomainTypeElement.getGetterMethod(currentPath); VariableElement field = MethodHelper.getField(instantiableDomainTypeElement.asConfigurationElement(), currentPath);
} else if (!entityResolver.isImmutable(domainTypeElement.asElement())) { VariableElement field = MethodHelper.getField(domainTypeElement.asConfigurationElement(), domainPathResolver.getCurrent());