本文整理汇总了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);
}
}
}