本文整理匯總了Java中javax.annotation.processing.Processor.getSupportedSourceVersion方法的典型用法代碼示例。如果您正苦於以下問題:Java Processor.getSupportedSourceVersion方法的具體用法?Java Processor.getSupportedSourceVersion怎麽用?Java Processor.getSupportedSourceVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.annotation.processing.Processor
的用法示例。
在下文中一共展示了Processor.getSupportedSourceVersion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ProcessorInfo
import javax.annotation.processing.Processor; //導入方法依賴的package包/類
/**
* Create a ProcessorInfo wrapping a particular Processor. The Processor must already have been
* initialized (that is,
* {@link Processor#init(javax.annotation.processing.ProcessingEnvironment)} must already have
* been called). Its getSupportedXXX() methods will be called and the results will be cached.
*/
public ProcessorInfo(Processor p)
{
_processor = p;
_hasBeenCalled = false;
_supportedSourceVersion = p.getSupportedSourceVersion();
_supportedOptions = p.getSupportedOptions();
Set<String> supportedAnnotationTypes = p.getSupportedAnnotationTypes();
boolean supportsStar = false;
if (null != supportedAnnotationTypes && !supportedAnnotationTypes.isEmpty()) {
StringBuilder regex = new StringBuilder();
Iterator<String> iName = supportedAnnotationTypes.iterator();
while (true) {
String name = iName.next();
supportsStar |= "*".equals(name); //$NON-NLS-1$
String escapedName1 = name.replace(".", "\\."); //$NON-NLS-1$ //$NON-NLS-2$
String escapedName2 = escapedName1.replace("*", ".*"); //$NON-NLS-1$ //$NON-NLS-2$
regex.append(escapedName2);
if (!iName.hasNext()) {
break;
}
regex.append('|');
}
_supportedAnnotationTypesPattern = Pattern.compile(regex.toString());
}
else {
_supportedAnnotationTypesPattern = null;
}
_supportsStar = supportsStar;
}
示例2: testWrappedSupportedSourceVersionCall
import javax.annotation.processing.Processor; //導入方法依賴的package包/類
@Test
public void testWrappedSupportedSourceVersionCall() {
AbstractProcessor processorSpy = Mockito.spy(AbstractProcessor.class);
Processor unit = AnnotationProcessorWrapper.wrapProcessor(processorSpy);
unit.getSupportedSourceVersion();
Mockito.verify(processorSpy).getSupportedSourceVersion();
}
開發者ID:toolisticon,項目名稱:annotation-processor-toolkit,代碼行數:13,代碼來源:AnnotationProcessorWrapperTest.java