@Override protected MutableDeclaredType getDelegate() { return bean.clone().addClassSufix(BEAN_WRAPPER_SUFFIX); } }
protected MutableTypeMirror getWildcardDelegate(MutableTypeMirror domainDelegate) { if (domainDelegate.getKind().isDeclared() && ((MutableDeclaredType)domainDelegate).getTypeVariables().size() == 1) { return ((MutableDeclaredType)domainDelegate).clone().setTypeVariables(processingEnv.getTypeUtils().getWildcardType((MutableTypeMirror)null, (MutableTypeMirror)null)); } return domainDelegate; }
private static MutableDeclaredType getOutputName(MutableDeclaredType type) { return type.clone().changePackage(new DefaultPackageValidatorProvider().get(type).moveTo(LayerType.MODEL)).addClassSufix(SUFFIX); }
private String getImportPackage(MutableDeclaredType type) { if (type.getEnclosedClass() != null) { return type.getEnclosedClass().getCanonicalName(); } return type.getPackageName(); };
@Override protected MutableDeclaredType getDelegate() { return type.clone().setSimpleName(type.getSimpleName() + CONVERTER_PROVIDER_CONTEXT_SUFFIX); }
private MutableDeclaredType toOutput(MutableDeclaredType inputType, MutableProcessingEnvironment processingEnv) { MutableDeclaredType result = inputType.clone(); PackageValidator packageValidator = getPackageValidatorProvider().get(result); if (packageValidator.isValid()) { packageValidator.moveTo(LocationType.SERVER).moveTo(LayerType.DAO).moveTo(ImplementationType.API); } else { packageValidator.setType(LocationType.SERVER.getName() + "." + LayerType.DAO.getName() + "." + ImplementationType.API.getName()); } return result.changePackage(packageValidator.toString()) .addClassSufix(DAO_API_CLASS_SUFFIX) .setTypeVariables(processingEnv.getTypeUtils().getTypeVariable("T", getDataType(inputType))); }
protected MutableDeclaredType getDataType(MutableDeclaredType inputType) { if (inputType.getTypeVariables().size() > 0) { MutableTypeVariable[] typeVariables = new MutableTypeVariable[inputType.getTypeVariables().size()]; for (int i = 0; i < inputType.getTypeVariables().size(); i++) { typeVariables[i] = processingEnv.getTypeUtils().getTypeVariable(MutableWildcardType.WILDCARD_NAME); } inputType = inputType.clone().setTypeVariables(typeVariables); } if (inputType.getAnnotation(DomainInterface.class) != null) { return new DomainDataInterfaceType(inputType, processingEnv); } return inputType; }
protected MutableTypeMirror toPrintableType(MutableTypeMirror mutableType) { if (mutableType.getKind().isDeclared()) { MutableDeclaredType declaredType = (MutableDeclaredType)mutableType; return declaredType.clone().stripTypeParametersTypes(); } return mutableType; } }
@Override protected MutableDeclaredType getDelegate() { MutableDeclaredType result = mutableDomainType.clone(); PackageValidator packageValidator = getPackageValidatorProvider().get(result); packageValidator.moveTo(LocationType.SERVER).moveTo(LayerType.DAO); if (packageValidator.isValid()) { packageValidator.moveTo(ImplementationType.HIBERNATE); } else { packageValidator.setType(LayerType.DAO.getName() + "." + ImplementationType.HIBERNATE.getName()); } return result.changePackage(packageValidator.toString()) .addClassPrefix(DAO_API_CLASS_PREFIX) .addClassSufix(DAO_API_CLASS_SUFFIX); }
@Override protected MutableDeclaredType getDelegate() { MutableDeclaredType result = roundContext.getMutableType().clone(); result.addClassSufix(SUFFIX); result.setKind(MutableTypeKind.INTERFACE); return result; } }
private MutableTypeMirror findSubtypesForWildcards(MutableTypeMirror type, ExecutableElement ownerMethod) { if (type == null) { return null; } switch (type.getKind()) { case CLASS: case INTERFACE: MutableDeclaredType clone = ((MutableDeclaredType)type).clone(); List<? extends MutableTypeVariable> typeVariables = clone.getTypeVariables(); clone.setTypeVariables(getSubtypesForWildcards((MutableDeclaredType)processingEnv.getTypeUtils().toMutableType(processingEnv.getElementUtils().getTypeElement(((MutableDeclaredType)type).getCanonicalName())), typeVariables, ownerMethod).toArray(new MutableTypeVariable[] {})); return clone; case TYPEVAR: if (((MutableTypeVariable)type).getVariable() != null && ((MutableTypeVariable)type).getVariable() == MutableWildcardType.WILDCARD_NAME) { return getBoundType(((MutableTypeVariable)type).clone(), ownerMethod); } default: return type; } }
printableType = ((MutableDeclaredType)printableType).clone().stripTypeParametersTypes().stripWildcards(); ((MutableDeclaredType)printableType).hasTypeParameters() && ((MutableDeclaredType)printableType).getTypeVariables().size() == 1 && !printableType.toString(ClassSerializer.CANONICAL, true).equals(setterType.toString(ClassSerializer.CANONICAL, true)); pw.print(", ",((MutableDeclaredType)printableType).getTypeVariables().get(0), ".class)");
@Override protected MutableDeclaredType getDelegate() { MutableDeclaredType mutableType = processingEnv.getTypeUtils().toMutableType((DeclaredType)mapBasedElement.asType()); mutableType.changePackage(mutableType.getPackageName() + ".shared.domain").addClassSufix("MapBean"); return mutableType; } }
@Override protected MutableDeclaredType getDelegate() { MutableDeclaredType outputName = getOutputName(annotationNamedType); if (annotationNamedType.getEnclosedClass() != null) { outputName = outputName.setEnclosedClass(annotationNamedType.getEnclosedClass().clone()); } outputName.setKind(MutableTypeKind.CLASS); return outputName; }
protected MutableDeclaredType getDataObject(MutableDeclaredType type) { if (type.asType() != null) { if (new DomainInterfaceAccessor(((DeclaredType)type.asType()).asElement(), processingEnv).isValid()) { return new DomainDataInterfaceType((MutableDeclaredType)type, processingEnv); } } if (type.hasTypeParameters()) { List<? extends MutableTypeVariable> typeVariables = type.getTypeVariables(); MutableTypeVariable[] dataTypeVariables = new MutableTypeVariable[typeVariables.size()]; int i = 0; for (MutableTypeVariable typeVariable: typeVariables) { dataTypeVariables[i++] = getDataObject(typeVariable); } type.setTypeVariables(dataTypeVariables); } return type; }
MutableDeclaredType mutableDeclaredType = (MutableDeclaredType)type; if (mutableDeclaredType.asType() != null) { return mutableDeclaredType.asType(); if (mutableDeclaredType.getPackageName() == null) { for (TypeKind kind: TypeKind.values()) { if (kind.name().toLowerCase().equals(mutableDeclaredType.getSimpleName())) { return getPrimitiveType(kind); TypeElement typeElement = elements.getTypeElement(mutableDeclaredType.getCanonicalName()); if (mutableDeclaredType.getTypeVariables().size() == typeElement.getTypeParameters().size()) { for (MutableTypeVariable typeParameter: mutableDeclaredType.getTypeVariables()) {
public BeanWrapperImplementationType(MutableDeclaredType bean, MutableProcessingEnvironment processingEnv) { this.bean = bean; setKind(MutableTypeKind.CLASS); List<MutableTypeMirror> interfaces = new ArrayList<MutableTypeMirror>(); interfaces.add(new BeanWrapperType(bean.clone().stripTypeParametersTypes(), processingEnv)); setInterfaces(interfaces); List<Modifier> modifiers = new ArrayList<Modifier>(); modifiers.addAll(bean.getModifiers()); modifiers.remove(Modifier.STATIC); setModifier(modifiers.toArray(new Modifier[] {})); }
public MutableDeclaredType getLocalServiceClass(MutableDeclaredType mutableType) { String simpleName = mutableType.getSimpleName(); if (simpleName.endsWith(REMOTE_SUFFIX)) { simpleName = simpleName.substring(0, simpleName.length() - REMOTE_SUFFIX.length()); } PackageValidator packageValidator = new DefaultPackageValidatorProvider().get(mutableType.getPackageName()); packageValidator.moveTo(LocationType.SERVER); mutableType = mutableType.changePackage(packageValidator); mutableType.cloneTypeVariables(remoteService); return mutableType.setSimpleName(simpleName + LOCAL_SUFFIX); }
for (Modifier modifier: type.getModifiers()) { pw.print(modifier.name().toLowerCase() + " "); pw.print(type.getKind().toString() + " " + type.toString(ClassSerializer.SIMPLE, false)); MutableDeclaredType superClassType = type.getSuperClass(); if (type.getTypeVariables().size() > 0) { pw.print("<"); for (MutableTypeVariable typeParameter : type.getTypeVariables()) { if (i > 0) { pw.print(", "); if (superClassType != null && !superClassType.toString(ClassSerializer.CANONICAL).equals(Object.class.getCanonicalName()) && !type.getKind().equals(MutableTypeKind.INTERFACE)) { pw.print(" extends ", superClassType); if (type.getInterfaces() != null && type.getInterfaces().size() > 0) { if (type.getKind().equals(MutableTypeKind.CLASS)) { pw.print(" implements "); supportedType = true; } else if (type.getKind().equals(MutableTypeKind.INTERFACE)) { pw.print(" extends "); supportedType = true; if (superClassType != null && !superClassType.toString(ClassSerializer.CANONICAL).equals(Object.class.getCanonicalName()) && type.getKind().equals(MutableTypeKind.INTERFACE)) { pw.print(toPrintableType(superClassType));
dto = processingEnv.getTransferObjectUtils().getDomainType(parameter.asType()).getDto(); if (((MutableDeclaredType)parameter.asType()).hasTypeParameters()) { ((DtoDeclaredType)dto).setTypeVariables(((MutableDeclaredType)parameter.asType()).getTypeVariables().toArray(new MutableTypeVariable[] {})); ((MutableDeclaredType)parameterElement.asType()).setTypeVariables(typeVariables.toArray(new MutableTypeVariable[] {})); copiedMethod.addModifier(Modifier.PUBLIC); context.getOutputType().addMethod(copiedMethod);