當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。