本文整理匯總了Java中com.squareup.javapoet.ClassName.reflectionName方法的典型用法代碼示例。如果您正苦於以下問題:Java ClassName.reflectionName方法的具體用法?Java ClassName.reflectionName怎麽用?Java ClassName.reflectionName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.squareup.javapoet.ClassName
的用法示例。
在下文中一共展示了ClassName.reflectionName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: putType
import com.squareup.javapoet.ClassName; //導入方法依賴的package包/類
/**
* Adds a {@link TypeSpec} to the set of files that will be generated at the end of the build pipeline.
* The {@link TypeSpec} will be put into the file under the qualified name {@code pkgName}.
* Will also add a service entry in each of the service classes listed in {@code providesServicesFor}
* @param pkgName The fully qualified name of the type to be created.
* @param newType the new type to be created at the end of the pipeline.
* @param providesServicesFor A list of classes that the given type provides the service for.
*/
public void putType(String pkgName, TypeSpec newType, List<ClassName> providesServicesFor) {
// This prevents us from opening the same file twice with the filer
// as well as letting the user know that the generated two files with the same name
addToMultiMap(outputClasses, pkgName, newType, "Attempted to generate 2 classes with the same name: ");
if (!providesServicesFor.isEmpty()) {
for (ClassName serviceInterface : providesServicesFor) {
String interfaceQName = serviceInterface.reflectionName();
// Here it is ok to have dups (but won't happen because of the same call above)
addToMultiMap(serviceProviders, interfaceQName, pkgName + "." + newType.name, null);
}
}
}