public static Set<MutableDeclaredType> toTypes(Type[] javaTypes, MutableProcessingEnvironment processingEnv) { Set<MutableDeclaredType> result = new HashSet<MutableDeclaredType>(); for (Type javaType: javaTypes) { result.add((MutableDeclaredType)processingEnv.getTypeUtils().toMutableType(javaType)); } return result; } }
private void copyInterfaces() { if (type != null && type.getKind().equals(TypeKind.DECLARED)) { TypeElement typeElement = (TypeElement)((DeclaredType)type).asElement(); for (TypeMirror interfaceType: typeElement.getInterfaces()) { interfaces.add(processingEnv.getTypeUtils().toMutableType(interfaceType)); } } }
private void copySuperclass() { if (type != null && type.getKind().equals(TypeKind.DECLARED)) { TypeElement typeElement = (TypeElement)((DeclaredType)type).asElement(); TypeMirror superclassType = typeElement.getSuperclass(); if (superclassType.getKind().equals(TypeKind.DECLARED) && !superclassType.toString().equals(Object.class.getName())) { this.superClass = processingEnv.getTypeUtils().toMutableType((DeclaredType) superclassType); } } }
public MutableTypeValue getTypeValue(Object value) { if (value.getClass().isArray()) { return getArrayValue(getArrayType(toMutableType(value.getClass().getComponentType())), (Object[])value); } if (value.getClass().isEnum()) { return getEnumValue(value); } return getTypeValue(toMutableType(value.getClass()), value); }
public SettingsTypeElement(AnnotationMirror configurationAnnotation, MutableProcessingEnvironment processingEnv) { this.annotationNamedType = toOutputType((MutableDeclaredType)processingEnv.getTypeUtils().toMutableType(configurationAnnotation.getAnnotationType())); this.annotationType = configurationAnnotation.getAnnotationType(); this.processingEnv = processingEnv; }
public MutableTypeValue getAnnotationTypeValue(Object value) { if (value.getClass().isArray()) { return getAnnotationArrayValue(getArrayType(toMutableType(value.getClass().getComponentType())), (Object[])value); } return getTypeValue(value); }
public AbstractDaoApiType(TypeElement typeElement, MutableProcessingEnvironment processingEnv) { this.mutableDeclaredType = null; this.processingEnv = processingEnv; setDelegate(processingEnv.getTypeUtils().toMutableType(typeElement)); }
protected MutableDeclaredType toParametrizedMutableDeclaredType(Class<?> baseType, Class<?>... typeVariables) { MutableDeclaredType mutableType = processingEnv.getTypeUtils().toMutableType(baseType); for(Class<?> typeVariable : typeVariables) { MutableDeclaredType typeVariableMirror = processingEnv.getTypeUtils().toMutableType(typeVariable); mutableType.addTypeVariable(processingEnv.getTypeUtils().getTypeVariable(null, typeVariableMirror)); } return mutableType; }
@Override public MutableTypeMirror getReturnType() { if (!this.returnType.isInitialized()) { if (methodElement != null) { this.returnType.setValue(processingEnv.getTypeUtils().toMutableType(methodElement.getReturnType())); } else { this.returnType.setValue(processingEnv.getTypeUtils().toMutableType(Void.class)); } } return this.returnType.getValue(); }
public void copyConstants(TypeElement element) { List<VariableElement> fields = ElementFilter.fieldsIn(element.getEnclosedElements()); for (VariableElement field: fields) { if (field.getModifiers().contains(Modifier.STATIC) && field.getModifiers().contains(Modifier.FINAL)) { MutableDeclaredTypeValue constantValue = processingEnv.getTypeUtils().getDeclaredValue( (MutableDeclaredType) processingEnv.getTypeUtils().toMutableType(field.asType()), field.getConstantValue()); pw.println("public static final ", field.asType(), " " + field.getSimpleName().toString() + " = ", constantValue, ";"); pw.println(); } } } }
private boolean isAbstract(TypeElement dataElement) { DomainDataInterfaceType domainDataInterfaceType = new DomainDataInterfaceType((MutableDeclaredType) processingEnv.getTypeUtils().toMutableType(dataElement.asType()), processingEnv); for (MutableTypeMirror interfaceType: domainDataInterfaceType.getInterfaces()) { if (!(interfaceType instanceof AbstractDataType)) { if (hasAbstractMethod( (TypeElement)((DeclaredType) processingEnv.getTypeUtils().fromMutableType(interfaceType)).asElement())) { return true; } } } return false; }
public ThemeUiBinderType(String name, MutableDeclaredType type, MutableProcessingEnvironment processingEnv) { this.mutableTypes = processingEnv.getTypeUtils(); this.prefixName = name; setKind(MutableTypeKind.INTERFACE); setSuperClass(mutableTypes.toMutableType(UiBinder.class).setTypeVariables(mutableTypes.getTypeVariable(null, mutableTypes.toMutableType(Element.class)), mutableTypes.getTypeVariable(null, type))); setModifier(); }
private String getParameterName(VariableElement parameter, ParameterElement... additionalParameters) { MutableTypes typeUtils = processingEnv.getTypeUtils(); for (ParameterElement additionalParameter: additionalParameters) { if (isPropagated(additionalParameter) && typeUtils.isSameType(typeUtils.toMutableType(parameter.asType()), additionalParameter.getType())) { return additionalParameter.getName(); } } return null; }
public MutableAnnotationMirror toMutableAnnotation(Class<?> clazz, String name, Object value) { MutableAnnotation mutableAnnotation = new MutableAnnotation(toMutableType(clazz), processingEnv); mutableAnnotation.setAnnotationValue(name, processingEnv.getTypeUtils().getTypeValue(value)); return mutableAnnotation; }
@Override protected ParameterElement getEntityManagerModel() { return new ParameterElement(processingEnv.getTypeUtils().toMutableType(EntityManager.class), ENTITY_MANAGER_NAME, getEntityManagerReference(), getEntityManagerPropagation(), processingEnv); } };
protected DomainType getDomainForType(TypeMirror type) { if (type.getKind().equals(TypeKind.DECLARED)) { List<MutableDeclaredType> domainDataTypes = new DataTypeResolver(environmentContext).getDomainData((MutableDeclaredType) environmentContext.getProcessingEnv().getTypeUtils().toMutableType(type)); if (domainDataTypes.size() > 0) { return super.getDomainForType(environmentContext.getProcessingEnv().getElementUtils().getTypeElement(domainDataTypes.get(0).getCanonicalName()).asType()); } } return super.getDomainForType(type); }
public ConverterProviderContextType(MutableDeclaredType type, MutableProcessingEnvironment processingEnv) { this.type = type; this.processingEnv = processingEnv; addModifier(Modifier.PUBLIC); setKind(MutableTypeKind.CLASS); setSuperClass(processingEnv.getTypeUtils().toMutableType(getContextSuperClass())); }
private List<MutableDeclaredType> getDomainDataInterfaces() { if (dataInterfacesValue.isInitialized()) { return dataInterfacesValue.getValue(); } TypeElement declaredDomainType = getTransferObjectMappingAccessor().getDomain(); if (declaredDomainType != null) { return dataInterfacesValue.setValue(dataTypeResolver.getDomainData(getTypeUtils().toMutableType(declaredDomainType))); } return dataInterfacesValue.setValue(new ArrayList<MutableDeclaredType>()); }
@Override public void initialize(final ConverterProviderContextType contextType) { // final MutableExecutableType converterProviderContextMethod = processingEnv.getTypeUtils().getExecutable(context.getConvertProviderContextType(), HibernateServiceConverterProviderParameterResolver.GET_CONVERTER_PROVIDER_CONTEXT_METHOD); // converterProviderContextMethod.addModifier(Modifier.PROTECTED); // serviceTypeElement.getServiceConverter().addMethod(converterProviderContextMethod); // HierarchyPrintWriter methodPrinter = converterProviderContextMethod.getPrintWriter(); this.contextType = contextType; initializeContextMethod = processingEnv.getTypeUtils().getExecutable(processingEnv.getTypeUtils().toMutableType(Void.class), "initialize"); initializeContextMethod.addModifier(Modifier.PUBLIC); contextType.addMethod(initializeContextMethod); super.initialize(contextType); }
protected MutableReferenceType getTransactionModelReference(TransactionPropagationAccessor transactionPropagationAccessor) { MutableTypes typeUtils = processingEnv.getTypeUtils(); MutableDeclaredType transactionPropagationModel = typeUtils.toMutableType(TransactionPropagationModel.class); return processingEnv.getTypeUtils().getReference(typeUtils.getArrayValue(typeUtils.getArrayType(transactionPropagationModel), (Object[])transactionPropagationAccessor.getPropagations()), HibernateParameterResolverDelegate.TRANSACTION_PROPAGATION_NAME); }