本文整理汇总了Java中javax.annotation.processing.Processor.init方法的典型用法代码示例。如果您正苦于以下问题:Java Processor.init方法的具体用法?Java Processor.init怎么用?Java Processor.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.annotation.processing.Processor
的用法示例。
在下文中一共展示了Processor.init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: discoverNextProcessor
import javax.annotation.processing.Processor; //导入方法依赖的package包/类
@Override
public ProcessorInfo discoverNextProcessor() {
if (processors.hasNext()) {
Processor processor = processors.next();
processor.init(_processingEnv);
ProcessorInfo procecssorInfo = new ProcessorInfo(processor) {
// the goal is to notify incrementalCompiler when annotation processing is taking place
// as of jdt.apt 1.3.0 this method is called right before running an annotation processor
// which is close enough to what we need
@Override
public boolean computeSupportedAnnotations(Set<TypeElement> annotations, Set<TypeElement> result) {
boolean shouldCall = super.computeSupportedAnnotations(annotations, result);
if (shouldCall) {
incrementalCompiler.onAnnotationProcessing();
}
return shouldCall;
}
};
_processors.add(procecssorInfo); // TODO this needs to happen in RoundDispatcher.round()
return procecssorInfo;
}
return null;
}
示例2: apply
import javax.annotation.processing.Processor; //导入方法依赖的package包/类
public boolean apply(Processor processor) {
ProcessingEnvironment processingEnvironment = mock(ProcessingEnvironment.class);
when(processingEnvironment.getOptions()).thenReturn(options);
when(processingEnvironment.getTypeUtils()).thenReturn(types);
when(processingEnvironment.getElementUtils()).thenReturn(elements);
processor.init(processingEnvironment);
return processor.process(environment.getAnnotations(), environment);
}
示例3: testWrappedInitCall
import javax.annotation.processing.Processor; //导入方法依赖的package包/类
@Test
public void testWrappedInitCall() {
AbstractProcessor processorSpy = Mockito.spy(AbstractProcessor.class);
Messager messager = Mockito.spy(Messager.class);
ProcessingEnvironment processingEnvironment = Mockito.spy(ProcessingEnvironment.class);
Mockito.when(processingEnvironment.getMessager()).thenReturn(messager);
Processor unit = AnnotationProcessorWrapper.wrapProcessor(processorSpy);
unit.init(processingEnvironment);
Mockito.verify(processorSpy).init(processingEnvironment);
}
开发者ID:toolisticon,项目名称:annotation-processor-toolkit,代码行数:17,代码来源:AnnotationProcessorWrapperTest.java
示例4: testWrappedProcessCall
import javax.annotation.processing.Processor; //导入方法依赖的package包/类
@Test
public void testWrappedProcessCall() {
AbstractProcessor processorSpy = Mockito.spy(AbstractProcessor.class);
Messager messager = Mockito.spy(Messager.class);
ProcessingEnvironment processingEnvironment = Mockito.spy(ProcessingEnvironment.class);
Mockito.when(processingEnvironment.getMessager()).thenReturn(messager);
Processor unit = AnnotationProcessorWrapper.wrapProcessor(processorSpy);
unit.init(processingEnvironment);
Set<? extends TypeElement> set = new HashSet<TypeElement>();
RoundEnvironment roundEnvironment = Mockito.mock(RoundEnvironment.class);
unit.process(set, roundEnvironment);
Mockito.verify(messager).printMessage(Diagnostic.Kind.NOTE, AbstractAnnotationProcessorTest.TEST_EXECUTION_MESSAGE);
Mockito.verify(processorSpy).process(set, roundEnvironment);
}
开发者ID:toolisticon,项目名称:annotation-processor-toolkit,代码行数:24,代码来源:AnnotationProcessorWrapperTest.java