protected void printCopyByLocalConverter(String domainField, DomainType domainMethodReturnType, String dtoField, FormattedPrintWriter pw) { pw.println("} else {"); pw.print(TransferObjectElementPrinter.RESULT_NAME + "." + MethodHelper.toSetter(dtoField)); if (domainMethodReturnType.getKind().equals(MutableTypeKind.TYPEVAR)) { pw.print("((" + ConverterTypeElement.DTO_TYPE_ARGUMENT_PREFIX + "_" + ((MutableTypeVariable)domainMethodReturnType).getVariable() + ")"); } else { pw.print("((", domainMethodReturnType.getDto(), ")"); } pw.print(TransferObjectElementPrinter.DOMAIN_NAME + "." + domainField); pw.println(");"); pw.println("}"); } }
private void printDomainTypeVariables(Set<? extends MutableTypeMirror> types, ExecutableElement localMethod, ConverterProviderElementPrinter nestedPrinter) { for (MutableTypeMirror type: types) { DomainType domainType = processingEnv.getTransferObjectUtils().getDomainType(type); if (domainType.getKind().isDeclared() && domainType.getConverter() != null) { ServiceConverterProviderPrinterContext context = new ServiceConverterProviderPrinterContext((DomainDeclaredType)domainType, localMethod); nestedPrinter.print(context); } } }
public MutableTypeMirror getDelegateCast(TypeMirror domainType) { DomainType domainTypeElement = processingEnv.getTransferObjectUtils().getDomainType(domainType); MutableTypeMirror domainNamedType = processingEnv.getTypeUtils().toMutableType(domainType); return castToDelegate(domainNamedType, domainTypeElement.getDomainDefinitionConfiguration() == null ? null : domainTypeElement.getDomainDefinitionConfiguration().getDelegateConfigurationTypeElement(), true); }
String methodName = getDomainType(configurationTypeElement.getInstantiableDomain(), isCastRequired) + methodNameSuffix; if (domainId.getConverter() != null) { pw.print(domainId.getDto(), " " + DTO_ID + " = "); pw.print(methodNameSuffix); if (domainId.getConverter() != null) { pw.print(")");
protected boolean copy(TransferObjectContext context, FormattedPrintWriter pw, CopyMethodPrinter printer) { DomainType returnType = context.getDomainMethodReturnType(); switch (returnType.getKind()) { case VOID: processingEnv.getMessager().printMessage(Kind.ERROR, "[ERROR] Unable to process " + context.getDtoFieldName() + ". Unsupported result type: " + returnType.getKind()); return false; case ARRAY: //TODO return false; } printer.printCopyMethod(context, pw); return true; } }
private Set<? extends MutableTypeMirror> processBounds(Set<? extends MutableTypeMirror> bounds) { if (bounds.size() > 0) { Set<MutableTypeMirror> newBounds = new HashSet<MutableTypeMirror>(); Iterator<? extends MutableTypeMirror> iterator = bounds.iterator(); while (iterator.hasNext()) { MutableTypeMirror next = iterator.next(); if (next.getKind().isDeclared()) { List<MutableDeclaredType> dataInterfaces = new ArrayList<MutableDeclaredType>(); findDomainData(((MutableDeclaredType)next), dataInterfaces); if (dataInterfaces.size() > 0) { MutableDeclaredType dtoType = (MutableDeclaredType)envContext.getProcessingEnv().getTransferObjectUtils().getDomainType(next).getDto(); DomainDeclaredType domainDeclared = new DataDomainDeclared(dataInterfaces.get(0), dtoType, envContext, null/*, configurationContext*/); domainDeclared.setTypeVariables(new MutableTypeVariable[]{}); if (!hasCustomProperties((MutableDeclaredType) next, dataInterfaces.get(0))) { newBounds.add(domainDeclared); } else { newBounds.add(next); } } else { newBounds.add(next); } } else { newBounds.add(next); } } return newBounds; } return bounds; }
if (instantiableDomainReference.getConfigurations().size() > 0) { domainReference = domainReference.getConfigurations().get(0).getDomain(); if (!instantiableDomainReference.getKind().isDeclared()) { processingEnv.getMessager().printMessage( Kind.ERROR,
(context.getDomainMethodReturnType().getKind().equals(MutableTypeKind.TYPEVAR) ? "(" + context.getConverter().getDomain().toString(ClassSerializer.SIMPLE, true) + ")" : "") + TransferObjectElementPrinter.DOMAIN_NAME + "." + context.getDomainFieldName(), context.getConverter().getDomain()); TransferObjectMappingAccessor transferObjectMappingAccessor = new TransferObjectMappingAccessor(context.getDtoMethod(), processingEnv); pw.print(TransferObjectElementPrinter.RESULT_NAME + "." + MethodHelper.toSetter(context.getDtoFieldName()) + "("); if (context.getDomainMethodReturnType().getKind().equals(MutableTypeKind.TYPEVAR)) { pw.print("(" + ConverterTypeElement.DTO_TYPE_ARGUMENT_PREFIX + "_" + ((MutableTypeVariable)context.getDomainMethodReturnType()).getVariable().toString() + ")");
DtoType dto = domainIdTypeElement.getDto(); if (dto != null) { dtoIdType = dto; if (domainIdTypeElement.getConverter() != null) { pw.print(dtoIdType, " " + idName + " = "); Field field = new Field(methodName, processingEnv.getTypeUtils().toMutableType(domainIdTypeElement));
if (domainReturnType.getKind().equals(MutableTypeKind.CLASS) || domainReturnType.getKind().equals(MutableTypeKind.INTERFACE)) { pw.print(prefixDomainParameter(((MutableDeclaredType) remoteServiceTypeElement.toReturnType((DomainDeclared)domainReturnType))).clone()); } else { if (domain.getKind().equals(MutableTypeKind.CLASS) || domain.getKind().equals(MutableTypeKind.INTERFACE)) { pw.print(prefixDomainParameter(((MutableDeclaredType)domain).clone()).stripTypeParametersTypes()); } else {
DtoType returnDtoType = returnDomainType.getDto();
@Override protected void printType(MutableTypeMirror type, ConverterProviderPrinterContext context) { DomainType domainType = processingEnv.getTransferObjectUtils().getDomainType(type); if (domainType.getKind().isDeclared() && domainType.getConverter() != null) { context = new ServiceConverterProviderPrinterContext((DomainDeclaredType)domainType, ((ServiceConverterProviderPrinterContext)context).getLocalMethod()); print(context); } }
DomainType domainReference = currentElement.getDomainReference(getEntityResolver(), currentPath); if (domainReference != null && domainReference.getKind().isDeclared()) { currentElement = (DomainDeclaredType)domainReference; ExecutableElement nestedIdMethod = currentElement.getIdMethod(getEntityResolver());
copiedMethod.setReturnType(processingEnv.getTransferObjectUtils().getDomainType(domainMethodOwner.getMethod().getReturnType()).getDto()); dto = processingEnv.getTransferObjectUtils().getDomainType(parameter.asType()).getDto(); dto = processingEnv.getTransferObjectUtils().getDomainType(methodParameter.asType()).getDto();
protected MutableTypeMirror getDelegateCast(MutableTypeMirror domainNamedType, boolean stripWildcard) { TypeMirror domainType = processingEnv.getTypeUtils().fromMutableType(domainNamedType); if (domainType == null) { return domainNamedType; } DomainType domainTypeElement = processingEnv.getTransferObjectUtils().getDomainType(domainType); return castToDelegate(domainNamedType, domainTypeElement.getDomainDefinitionConfiguration() == null ? null : domainTypeElement.getDomainDefinitionConfiguration().getDelegateConfigurationTypeElement(), stripWildcard); }
protected void printCopyByLocalConverter(String localConverterName, PathResolver domainPathResolver, DomainType domainMethodReturnType, String dtoField, FormattedPrintWriter pw) { pw.println("if (" + localConverterName + " != null) {"); pw.print(TransferObjectElementPrinter.RESULT_NAME + "." + MethodHelper.toSetter(domainPathResolver.getPath()) + "(" + localConverterName + ".fromDto(" + TransferObjectElementPrinter.DTO_NAME + "." + MethodHelper.toGetter(dtoField) + ")"); pw.println(");"); pw.println("} else {"); pw.print(TransferObjectElementPrinter.RESULT_NAME + "." + MethodHelper.toSetter(domainPathResolver.getPath())); if (domainMethodReturnType.getKind().equals(MutableTypeKind.TYPEVAR)) { pw.print("((" + ConverterTypeElement.DOMAIN_TYPE_ARGUMENT_PREFIX + "_" + ((MutableTypeVariable) domainMethodReturnType).getVariable() + ")"); } else { pw.print("((" + domainMethodReturnType + ")"); } pw.print(TransferObjectElementPrinter.DTO_NAME + "." + MethodHelper.toGetter(dtoField)); pw.println(");"); pw.println("}"); } }
if (domain != null && domain.getDomainDefinitionConfiguration() != null) { dtoHasClone = new GenerateCloneAccessor(domain.getDomainDefinitionConfiguration().asConfigurationElement(), processingEnv).generate(); if (context.getDomainMethodReturnType().getDomainDefinitionConfiguration() != null) { dtoHasClone = new GenerateCloneAccessor(context.getDomainMethodReturnType().getDomainDefinitionConfiguration().asConfigurationElement(), processingEnv).generate();
pw.print(context.getConverter().getConverterBase(), " " + converterName + " = "); Field field = new Field((context.getDomainMethodReturnType().getKind().equals(MutableTypeKind.TYPEVAR) ? "(" + context.getConverter().getDto() + ")" : "") + TransferObjectElementPrinter.DTO_NAME + "." + MethodHelper.toGetter(context.getDtoFieldName()), context.getConverter().getDto()); TransferObjectMappingAccessor transferObjectMappingAccessor = new TransferObjectMappingAccessor(context.getDtoMethod(), processingEnv); pw.print(TransferObjectElementPrinter.RESULT_NAME + "." + MethodHelper.toSetter(domainPathResolver.getPath()) + "("); if (context.getDomainMethodReturnType().getKind().equals(MutableTypeKind.TYPEVAR)) { pw.print("(" + ConverterTypeElement.DOMAIN_TYPE_ARGUMENT_PREFIX + "_" + ((MutableTypeVariable) context.getDomainMethodReturnType()).getVariable().toString() + ")");