當前位置: 首頁>>代碼示例>>Java>>正文


Java Processor.getSupportedSourceVersion方法代碼示例

本文整理匯總了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;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:37,代碼來源:ProcessorInfo.java

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


注:本文中的javax.annotation.processing.Processor.getSupportedSourceVersion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。