@Override public void print(ConverterProviderPrinterContext context) { if (types.size() == 0) { initializeDomainConverterMethod(); } if (!types.contains(context.getRawDomain().getCanonicalName())) { types.add(context.getRawDomain().getCanonicalName()); } } }
protected boolean isId(TransferObjectContext context) { return (processingEnv.getTypeUtils().isAssignable(processingEnv.getElementUtils().getTypeElement(context.getConfigurationTypeElement().getInstantiableDomain().getCanonicalName()).asType(), context.getDomainMethod().getEnclosingElement().asType()) && isIdField(context.getConfigurationTypeElement().getInstantiableDomain(), context.getDomainMethod().getSimpleName().toString())); }
protected ExecutableElement getSetterMethod(TransferObjectContext context, PathResolver domainPathResolver) { TypeElement typeElement = processingEnv.getElementUtils().getTypeElement(context.getConfigurationTypeElement().getDomain().getCanonicalName()); return getSetterMethod(typeElement, domainPathResolver); //return ProcessorUtils.getMethod(MethodHelper.toSetter(domainPathResolver.getPath()), typeElement)); }
private TransferObjectContext createTOContext(ExecutableElement method, DomainDeclaredType domainTypeElement, boolean superClassMethod, ConfigurationTypeElement configurationTypeElement, List<String> generated) { String fieldName = TransferObjectHelper.getFieldPath(method); if (contains(generated, fieldName)) { return null; } TypeElement domainElement = environmentContext.getProcessingEnv().getElementUtils().getTypeElement(domainTypeElement.getCanonicalName()); ExecutableElement overrider = ProcessorUtils.getOverrider(domainElement, method, processingEnv); if (overrider != null) { method = overrider; } TransferObjectContext context = transferObjectContextProvider.get(configurationTypeElement, Modifier.PUBLIC, method, method, superClassMethod); if (context == null) { return null; } generated.add(fieldName); return context; }
protected void printCastDomainType(TransferObjectContext context, PathResolver domainPathResolver, DomainType inputDomainType, FormattedPrintWriter pw) { MutableTypeMirror parameterType = getParameterType(context, domainPathResolver); MutableTypeMirror domainType = getTypeVariableDelegate(getDelegateCast(inputDomainType, true)); if (!isCastRequired(parameterType)) { pw.print(domainType); } else { MutableDeclaredType declaredParameter = (MutableDeclaredType) parameterType; MutableTypeMirror typeParameter = getTypeParameter(declaredParameter); if (typeParameter == null) { pw.print(domainType); } else { if (typeParameter.isSameType(domainType) || ProcessorUtils.implementsType(processingEnv.getElementUtils().getTypeElement(domainType.toString(ClassSerializer.CANONICAL, false)) .asType(), processingEnv.getElementUtils().getTypeElement(typeParameter.toString(ClassSerializer.CANONICAL, false)).asType())) { pw.print(domainType); } else { processingEnv.getMessager().printMessage(Kind.NOTE, "Params: [1] InputDomainType: " + inputDomainType.toString()); processingEnv.getMessager().printMessage( Kind.ERROR, "Method " + getSetterMethod(context, domainPathResolver).getSimpleName().toString() + " in type " + context.getConfigurationTypeElement().getDomain().getCanonicalName() + " has parameter of type " + typeParameter.toString() + " but " + domainType.toString() + " was expected!"); } } } }
TypeElement typeElement = processingEnv.getElementUtils().getTypeElement(configurationTypeElement.getInstantiableDomain().getCanonicalName()); configurationTypeElement.getInstantiableDomain().getCanonicalName() + ". Please add source class on the classpath also."); } else { MethodOwner domainMethodOwner = configurationTypeElement.getInstantiableDomain().getMethodOwnerByName(overridenMethod.getSimpleName().toString()); configurationTypeElement.getInstantiableDomain().getCanonicalName() + ". Please check your configuration " + configurationTypeElement.toString(ClassSerializer.SIMPLE) + "."); return; configurationTypeElement.getInstantiableDomain().getCanonicalName() + ". Please add source class on the classpath also."); } else { configurationTypeElement.getInstantiableDomain().getCanonicalName() + ". Please check your configuration " + configurationTypeElement.toString(ClassSerializer.SIMPLE) + "."); return;
" in the domain class " + domainTypeElement.getCanonicalName(), configurationTypeElement.asConfigurationElement()); continue; processingEnv.getMessager().printMessage(Kind.ERROR, "[ERROR] Unable to find id method in the class " + currentElement.getCanonicalName() + ". If the class/interface does not have strictly specified ID, please specify the id in the configuration using " + Id.class.getCanonicalName() + " annotation.", configurationTypeElement.asConfigurationElement());
pw.print(context.getDtoMethod().getSimpleName().toString() + "()"); } else { TypeElement typeElement = processingEnv.getElementUtils().getTypeElement(context.getConfigurationTypeElement().getDomain().getCanonicalName()); pw.print(MethodHelper.toGetterMethod(typeElement, context.getDtoFieldName()));
processingEnv.getMessager().printMessage(Kind.ERROR, configurationTypeElement.getInstantiableDomain().getCanonicalName() + " does not have an ID method implemented. Please implement ID method so equals method should be implemented."); return; ProcessorUtils.erasure(processingEnv.getElementUtils().getTypeElement(configurationTypeElement.getDomain().getCanonicalName()), (TypeVariable)returnIdType); processingEnv.getElementUtils().getTypeElement(Serializable.class.getCanonicalName()).asType())) { processingEnv.getMessager().printMessage(Kind.ERROR, configurationTypeElement.getDomain().getCanonicalName() + " has ID that does not implement serializable! ID method should implement serializable interface.");
pw.print(" && "); TypeElement typeElement = processingEnv.getElementUtils().getTypeElement(context.getConfigurationTypeElement().getDomain().getCanonicalName()); methodPath += "." + MethodHelper.toGetterMethod(typeElement, path); TypeElement typeElement = processingEnv.getElementUtils().getTypeElement(context.getConfigurationTypeElement().getInstantiableDomain().getCanonicalName());