private void collectTypeConverters(MutableTypeMirror type, Set<ConverterTypeElement> converters, List<ConverterConstructorParameter> parameters) { DtoType dtoType = processingEnv.getTransferObjectUtils().getDtoType(type); ConverterTypeElement converter = dtoType.getConverter(); if (converter != null && !converters.contains(converter)) { parameters.addAll(converter.getConverterParameters(parametersResolverProvider.getParameterResolver(UsageType.DEFINITION), ConverterInstancerType.SERVICE_CONVERETR_INSTANCER)); converters.add(converter); if (dtoType.getKind().equals(MutableTypeKind.CLASS) || dtoType.getKind().equals(MutableTypeKind.INTERFACE)) { for (MutableTypeVariable typeVariable: ((MutableDeclaredType)dtoType).getTypeVariables()) { for (MutableTypeMirror lowerBound: typeVariable.getLowerBounds()) { collectTypeConverters(lowerBound, converters, parameters); } for (MutableTypeMirror upperBound: typeVariable.getUpperBounds()) { collectTypeConverters(upperBound, converters, parameters); } } } } }
@Override protected void printType(MutableTypeMirror type, ConverterProviderPrinterContext context) { DtoType dtoType = processingEnv.getTransferObjectUtils().getDtoType(type); if (dtoType.getKind().isDeclared() && dtoType.getConverter() != null) { print(new ServiceConverterProviderPrinterContext((DtoDeclaredType)dtoType, ((ServiceConverterProviderPrinterContext)context).getLocalMethod(), context.getConfigurationType())); } }
private void printDtoTypeVariables(Set<? extends MutableTypeMirror> types, ExecutableElement localMethod, ConverterProviderElementPrinter nestedPrinter) { for (MutableTypeMirror type: types) { DtoType dtoType = processingEnv.getTransferObjectUtils().getDtoType(type); if (dtoType.getKind().isDeclared() && dtoType.getConverter() != null) { ServiceConverterProviderPrinterContext context = new ServiceConverterProviderPrinterContext((DtoDeclaredType)dtoType, localMethod, dtoType.getConverter().getConfiguration()); nestedPrinter.print(context); } } }
switch (context.getDtoFieldType().getKind()) { case PRIMITIVE: String className = context.getDtoFieldType().toString(); case VOID: case TYPEVAR: processingEnv.getMessager().printMessage(Kind.WARNING, "[WARNING] Unsupported type " + context.getDtoFieldName() + " (" + context.getDtoFieldType().getKind() + ") in the " + context.getConfigurationTypeElement().asConfigurationElement(), context.getConfigurationTypeElement().asConfigurationElement()); return;
switch (context.getDtoFieldType().getKind()) { case ENUM: case PRIMITIVE: if (context.getDtoFieldType().getKind().equals(MutableTypeMirror.MutableTypeKind.CLASS) || context.getDtoFieldType().getKind().equals(MutableTypeMirror.MutableTypeKind.INTERFACE)) { }else if (context.getDtoFieldType().getKind().equals(MutableTypeMirror.MutableTypeKind.TYPEVAR)) { Set<? extends MutableTypeMirror> lowerBounds = ((MutableTypeVariable) context.getDtoFieldType()).getLowerBounds(); case VOID: case TYPEVAR: processingEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, "[WARNING] Unsupported type " + context.getDtoFieldName() + " (" + context.getDtoFieldType().getKind() + ") in the " + context.getConfigurationTypeElement().asConfigurationElement(), context.getConfigurationTypeElement().asConfigurationElement()); return;
switch (context.getDtoFieldType().getKind()) { case ENUM: case PRIMITIVE: case VOID: case TYPEVAR: processingEnv.getMessager().printMessage(Kind.WARNING, "[WARNING] Unsupported type " + context.getDtoFieldName() + " (" + context.getDtoFieldType().getKind() + ") in the " + context.getConfigurationTypeElement().asConfigurationElement(), context.getConfigurationTypeElement().asConfigurationElement()); return;
switch (context.getDtoFieldType().getKind()) { case PRIMITIVE: case VOID: case TYPEVAR: processingEnv.getMessager().printMessage(Kind.WARNING, "[WARNING] Unsupported type " + context.getDtoFieldName() + " (" + context.getDtoFieldType().getKind() + ") in the " + context.getConfigurationTypeElement().asConfigurationElement(), context.getConfigurationTypeElement().asConfigurationElement()); return;