Java Code Examples for javax.annotation.processing.ProcessingEnvironment#getTypeUtils()
The following examples show how to use
javax.annotation.processing.ProcessingEnvironment#getTypeUtils() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OllieProcessor.java From Ollie with Apache License 2.0 | 6 votes |
@Override public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); registry = new Registry( processingEnv.getMessager(), processingEnv.getTypeUtils(), processingEnv.getElementUtils(), processingEnv.getFiler()); processingSteps = ImmutableSet.of( new MigrationStep(registry), new TypeAdapterStep(registry), new ColumnStep(registry), new ModelAdapterStep(registry), new AdapterHolderStep(registry)); }
Example 2
Source File: CombinedStateAutoValueExtension.java From reductor with Apache License 2.0 | 6 votes |
@Override public boolean applicable(Context context) { TypeElement typeElement = context.autoValueClass(); boolean isApplicable = typeElement.getAnnotation(CombinedState.class) != null; if (isApplicable) { ProcessingEnvironment processingEnvironment = context.processingEnvironment(); Env env = new Env(processingEnvironment.getTypeUtils(), processingEnvironment.getElementUtils(), processingEnvironment.getMessager(), processingEnvironment.getFiler()); try { CombinedStateElement combinedStateElement = CombinedStateElement.parseAutoValueCombinedElement(typeElement, context.properties()); CombinedStateProcessingStep.emmitCombinedReducer(env, combinedStateElement, ClassName.get(context.packageName(), "AutoValue_" + context.autoValueClass().getSimpleName())); } catch (ValidationException ve) { env.printError(ve.getElement(), ve.getMessage()); } catch (Exception e) { env.printError(typeElement, "Internal processor error:\n" + e.getMessage()); e.printStackTrace(); } } return false; }
Example 3
Source File: PaperParcelAutoValueExtension.java From paperparcel with Apache License 2.0 | 6 votes |
@Override public boolean applicable(Context context) { ProcessingEnvironment env = context.processingEnvironment(); Elements elements = env.getElementUtils(); Types types = env.getTypeUtils(); Messager messager = env.getMessager(); TypeMirror parcelable = elements.getTypeElement(PARCELABLE_CLASS_NAME).asType(); TypeElement autoValueTypeElement = context.autoValueClass(); if (types.isAssignable(autoValueTypeElement.asType(), parcelable)) { PaperParcelAutoValueExtensionValidator extensionValidator = new PaperParcelAutoValueExtensionValidator(elements, types); ValidationReport<TypeElement> report = extensionValidator.validate(autoValueTypeElement); report.printMessagesTo(messager); return report.isClean(); } return false; }
Example 4
Source File: EnumModel.java From vertx-codegen with Apache License 2.0 | 5 votes |
public EnumModel(ProcessingEnvironment env, TypeElement modelElt) { this.typeUtils = env.getTypeUtils(); this.elementUtils = env.getElementUtils(); this.typeMirrorFactory = new TypeMirrorFactory(elementUtils, typeUtils); this.docFactory = new Doc.Factory(env.getMessager(), elementUtils, typeUtils, typeMirrorFactory, modelElt); this.modelElt = modelElt; this.annotationValueInfoFactory = new AnnotationValueInfoFactory(typeMirrorFactory); this.deprecated = modelElt.getAnnotation(Deprecated.class) != null; }
Example 5
Source File: DurableEntityProcessor.java From mnemonic with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); typeUtils = processingEnv.getTypeUtils(); elementUtils = processingEnv.getElementUtils(); filer = processingEnv.getFiler(); messager = processingEnv.getMessager(); }
Example 6
Source File: OnActivityResultProcessor.java From OnActivityResult with Apache License 2.0 | 5 votes |
@Override public void init(final ProcessingEnvironment environment) { synchronized (this) { super.init(environment); typeUtils = environment.getTypeUtils(); elementUtils = environment.getElementUtils(); filer = environment.getFiler(); } }
Example 7
Source File: DataBindingAnnotationProcessor.java From data-mediator with Apache License 2.0 | 5 votes |
@Override public synchronized void init(ProcessingEnvironment env) { super.init(env); mContext = new ProcessorContext(env.getFiler(), env.getElementUtils(), env.getTypeUtils(), new ProcessorPrinter(env.getMessager())); mParser = new DataBindingParser(mContext); }
Example 8
Source File: EncodableProcessor.java From firebase-android-sdk with Apache License 2.0 | 5 votes |
@Override public synchronized void init(ProcessingEnvironment processingEnvironment) { super.init(processingEnvironment); elements = processingEnvironment.getElementUtils(); types = processingEnvironment.getTypeUtils(); getterFactory = new GetterFactory(types, elements, processingEnvironment.getMessager()); }
Example 9
Source File: ValueParser.java From dataenum with Apache License 2.0 | 5 votes |
private static boolean isValueSpecMarker( TypeMirror returnType, ProcessingEnvironment processingEnvironment) { Types types = processingEnvironment.getTypeUtils(); Elements elements = processingEnvironment.getElementUtils(); return types.isSameType( returnType, elements.getTypeElement(dataenum_case.class.getCanonicalName()).asType()); }
Example 10
Source File: ToothpickProcessor.java From toothpick with Apache License 2.0 | 5 votes |
@Override public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); elementUtils = processingEnv.getElementUtils(); typeUtils = processingEnv.getTypeUtils(); filer = processingEnv.getFiler(); }
Example 11
Source File: YodaoProcessor.java From YoDao with Apache License 2.0 | 5 votes |
@Override public synchronized void init(ProcessingEnvironment env) { super.init(env); elementUtils = env.getElementUtils(); typeUtils = env.getTypeUtils(); filer = env.getFiler(); }
Example 12
Source File: DataObjectModel.java From vertx-codegen with Apache License 2.0 | 5 votes |
public DataObjectModel(ProcessingEnvironment env, TypeMirrorFactory typeFactory, TypeElement modelElt) { this.elementUtils = env.getElementUtils(); this.typeUtils = env.getTypeUtils(); this.typeFactory = typeFactory; this.docFactory = new Doc.Factory(env.getMessager(), elementUtils, typeUtils, typeFactory, modelElt); this.modelElt = modelElt; this.annotationValueInfoFactory = new AnnotationValueInfoFactory(typeFactory); this.deprecated = modelElt.getAnnotation(Deprecated.class) != null; }
Example 13
Source File: ProcessorUtils.java From jackdaw with Apache License 2.0 | 5 votes |
public static TypeElement getWrappedType(final TypeMirror mirror) { final ProcessingEnvironment env = ProcessorContextHolder.getProcessingEnvironment(); final Types typeUtils = env.getTypeUtils(); final TypeKind kind = mirror.getKind(); final boolean primitive = kind.isPrimitive(); if (primitive) { return typeUtils.boxedClass((PrimitiveType) mirror); } return (TypeElement) typeUtils.asElement(mirror); }
Example 14
Source File: EntityHandler.java From RxPay with Apache License 2.0 | 5 votes |
public EntityHandler(ProcessingEnvironment processingEnv) { this.elementUtils = processingEnv.getElementUtils(); this.typeUtils = processingEnv.getTypeUtils(); this.filer = processingEnv.getFiler(); this.messager = processingEnv.getMessager(); classEntityMap = new HashMap<>(); }
Example 15
Source File: ProcessorContext.java From Akatsuki with Apache License 2.0 | 5 votes |
public ProcessorContext(ProcessingEnvironment environment) { this.environment = environment; this.types = environment.getTypeUtils(); this.elements = environment.getElementUtils(); this.utils = new ProcessorUtils(this.types, this.elements); }
Example 16
Source File: KratosProcessor.java From Kratos with GNU Lesser General Public License v3.0 | 5 votes |
@Override public synchronized void init(ProcessingEnvironment env) { super.init(env); elementUtils = env.getElementUtils(); typeUtils = env.getTypeUtils(); filer = env.getFiler(); }
Example 17
Source File: ProcessingUtils.java From Alligator with MIT License | 4 votes |
public ProcessingUtils(ProcessingEnvironment processingEnv) { typeUtils = processingEnv.getTypeUtils(); }
Example 18
Source File: Processor.java From vault with Apache License 2.0 | 4 votes |
@Override public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); elementUtils = processingEnv.getElementUtils(); typeUtils = processingEnv.getTypeUtils(); filer = processingEnv.getFiler(); }
Example 19
Source File: Analysis.java From dsl-json with BSD 3-Clause "New" or "Revised" License | 4 votes |
public Analysis( ProcessingEnvironment processingEnv, AnnotationUsage annotationUsage, LogLevel logLevel, TypeSupport typeSupport, @Nullable Set<String> alternativeIgnore, @Nullable Map<String, List<AnnotationMapping<Boolean>>> alternativeNonNullable, @Nullable Map<String, String> alternativeAlias, @Nullable Map<String, List<AnnotationMapping<Boolean>>> alternativeMandatory, @Nullable Set<String> alternativeCreators, @Nullable Map<String, String> alternativeIndex, @Nullable UnknownTypes unknownTypes, boolean onlyBasicFeatures, boolean includeFields, boolean includeBeanMethods, boolean includeExactMethods) { this.annotationUsage = annotationUsage; this.logLevel = logLevel; this.elements = processingEnv.getElementUtils(); this.types = processingEnv.getTypeUtils(); this.messager = processingEnv.getMessager(); this.compiledJsonElement = elements.getTypeElement(CompiledJson.class.getName()); this.compiledJsonType = types.getDeclaredType(compiledJsonElement); this.attributeElement = elements.getTypeElement(JsonAttribute.class.getName()); this.attributeType = types.getDeclaredType(attributeElement); this.converterElement = elements.getTypeElement(JsonConverter.class.getName()); this.converterType = types.getDeclaredType(converterElement); this.typeSupport = typeSupport; this.alternativeIgnore = alternativeIgnore == null ? new HashSet<String>() : alternativeIgnore; this.alternativeNonNullable = alternativeNonNullable == null ? new HashMap<String, List<AnnotationMapping<Boolean>>>() : alternativeNonNullable; this.alternativeAlias = alternativeAlias == null ? new HashMap<String, String>() : alternativeAlias; this.alternativeMandatory = alternativeMandatory == null ? new HashMap<String, List<AnnotationMapping<Boolean>>>() : alternativeMandatory; this.alternativeCreators = alternativeCreators == null ? new HashSet<String>() : alternativeCreators; this.alternativeIndex = alternativeIndex == null ? new HashMap<String, String>() : alternativeIndex; this.unknownTypes = unknownTypes == null ? UnknownTypes.ERROR : unknownTypes; this.onlyBasicFeatures = onlyBasicFeatures; this.includeFields = includeFields; this.includeBeanMethods = includeBeanMethods; this.includeExactMethods = includeExactMethods; this.baseListType = types.erasure(elements.getTypeElement(List.class.getName()).asType()); this.baseSetType = types.erasure(elements.getTypeElement(Set.class.getName()).asType()); this.baseMapType = types.erasure(elements.getTypeElement(Map.class.getName()).asType()); }
Example 20
Source File: TypeHelper.java From magic-starter with GNU Lesser General Public License v3.0 | 4 votes |
public TypeHelper(ProcessingEnvironment env) { this.env = env; this.types = env.getTypeUtils(); }