当前位置: 首页>>代码示例>>Java>>正文


Java Processor.init方法代码示例

本文整理汇总了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;
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:25,代码来源:AnnotationProcessorManager.java

示例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);
}
 
开发者ID:restful-api-description-language,项目名称:RADL,代码行数:10,代码来源:Project.java

示例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


注:本文中的javax.annotation.processing.Processor.init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。