本文整理了Java中com.squareup.javapoet.ClassName.simpleNames()
方法的一些代码示例,展示了ClassName.simpleNames()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassName.simpleNames()
方法的具体详情如下:
包路径:com.squareup.javapoet.ClassName
类名称:ClassName
方法名:simpleNames
暂无
代码示例来源:origin: square/dagger
/** Returns a class name to complement {@code type}. */
public static ClassName adapterName(ClassName type, String suffix) {
return ClassName.get(type.packageName(),
Joiner.on('$').join(type.simpleNames()) + suffix);
}
代码示例来源:origin: square/javapoet
public List<String> simpleNames() {
List<String> simpleNames = new ArrayList<>();
if (enclosingClassName != null) {
simpleNames.addAll(enclosingClassName().simpleNames());
}
simpleNames.add(simpleName);
return simpleNames;
}
代码示例来源:origin: bluelinelabs/LoganSquare
public static String getInjectedFQCN(ClassName className) {
StringBuilder name = new StringBuilder();
for (String part : className.simpleNames()) {
if (name.length() > 0) {
name.append("$");
}
name.append(part);
}
return className.packageName() + "." + name.toString() + Constants.MAPPER_CLASS_SUFFIX;
}
代码示例来源:origin: square/wire
private String reflectionName(ClassName className) {
return className.packageName().isEmpty()
? Joiner.on('$').join(className.simpleNames())
: className.packageName() + '.' + Joiner.on('$').join(className.simpleNames());
}
代码示例来源:origin: square/javapoet
int suffixOffset = c.simpleNames().size() - 1;
return join(".", className.simpleNames().subList(
suffixOffset, className.simpleNames().size()));
return join(".", className.simpleNames());
代码示例来源:origin: stephanenicolas/toothpick
protected static String getSimpleClassName(ClassName className) {
String result = "";
java.util.List<String> simpleNames = className.simpleNames();
for (int i = 0; i < simpleNames.size(); i++) {
String name = simpleNames.get(i);
result += name;
if (i != simpleNames.size() - 1) {
result += ".";
}
}
return result;
}
代码示例来源:origin: com.google.dagger/dagger-compiler
static String classFileName(ClassName className) {
return CLASS_FILE_NAME_JOINER.join(className.simpleNames());
}
代码示例来源:origin: org.raml/raml-to-pojo
private ClassName makeContained(String pack, ClassName currentSuggestion) {
if ( currentSuggestion.simpleNames().size() > 1) {
return ClassName.get(pack, currentSuggestion.simpleNames().get(0), currentSuggestion.simpleNames().subList(1, currentSuggestion.simpleNames().size()).toArray(new String[0]));
} else {
return ClassName.get(pack, currentSuggestion.simpleNames().get(0));
}
}
}
代码示例来源:origin: org.raml/raml-to-pojo
private ClassName makeContained(String pack, ClassName currentSuggestion) {
if ( currentSuggestion.simpleNames().size() > 1) {
return ClassName.get(pack, currentSuggestion.simpleNames().get(0), currentSuggestion.simpleNames().subList(1, currentSuggestion.simpleNames().size()).toArray(new String[0]));
} else {
return ClassName.get(pack, currentSuggestion.simpleNames().get(0));
}
}
代码示例来源:origin: com.github.stephanenicolas/toothpick-compiler
public static String getSimpleClassName(ClassName className) {
String result = "";
java.util.List<String> simpleNames = className.simpleNames();
for (int i = 0; i < simpleNames.size(); i++) {
String name = simpleNames.get(i);
result += name;
if (i != simpleNames.size() - 1) {
result += ".";
}
}
return result;
}
代码示例来源:origin: com.github.stephanenicolas.toothpick/toothpick-compiler
protected static String getSimpleClassName(ClassName className) {
String result = "";
java.util.List<String> simpleNames = className.simpleNames();
for (int i = 0; i < simpleNames.size(); i++) {
String name = simpleNames.get(i);
result += name;
if (i != simpleNames.size() - 1) {
result += ".";
}
}
return result;
}
代码示例来源:origin: br.com.objectos/way-code
public CodeCanvasWriter named(ClassName className) {
List<String> simpleNames = className.simpleNames();
String first = simpleNames.get(0);
Object[] rest = simpleNames.subList(1, simpleNames.size()).toArray();
name = Joiner.on('.').join(className.packageName(), first, rest);
return this;
}
代码示例来源:origin: contentful/vault
private ClassName getInjectionClassName(TypeElement typeElement, String suffix) {
ClassName specClassName = ClassName.get(typeElement);
return ClassName.get(specClassName.packageName(),
Joiner.on('$').join(specClassName.simpleNames()) + suffix);
}
代码示例来源:origin: maskarade/StaticGson
static String createTypeAdapterClassName(ClassName modelType) {
String modelClassName = modelType.simpleNames().stream().collect(Collectors.joining("$"));
return StaticGsonTypeAdapterFactory.getTypeAdapterFactoryName(modelClassName);
}
代码示例来源:origin: com.squareup.wire/wire-java-generator
private String reflectionName(ClassName className) {
return className.packageName() + '.' + Joiner.on('$').join(className.simpleNames());
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
public String reflectionName() {
// trivial case: no nested names
if (names.size() == 2) {
String packageName = packageName();
if (packageName.isEmpty()) {
return names.get(1);
}
return packageName + "." + names.get(1);
}
// concat top level class name and nested names
StringBuilder builder = new StringBuilder();
builder.append(topLevelClassName());
for (String name : simpleNames().subList(1, simpleNames().size())) {
builder.append('$').append(name);
}
return builder.toString();
}
代码示例来源:origin: xiaoxiangyeyuHeaven/JD-shopping-mall
public String reflectionName() {
// trivial case: no nested names
if (names.size() == 2) {
String packageName = packageName();
if (packageName.isEmpty()) {
return names.get(1);
}
return packageName + "." + names.get(1);
}
// concat top level class name and nested names
StringBuilder builder = new StringBuilder();
builder.append(topLevelClassName());
for (String name : simpleNames().subList(1, simpleNames().size())) {
builder.append('$').append(name);
}
return builder.toString();
}
代码示例来源:origin: evant/gsonvalue
private String classLiteralName(ClassName className) {
return className.packageName() + "." + StringUtils.join(".", className.simpleNames()) + ".class";
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
int suffixOffset = c.simpleNames().size() - 1;
return join(".", className.simpleNames().subList(
suffixOffset, className.simpleNames().size()));
return join(".", className.simpleNames());
代码示例来源:origin: IVIanuu/contributer
.topLevelClassName()
.peerClass(
Joiner.on('_').join(descriptor.enclosingModule().simpleNames())
+ "_"
+ LOWER_CAMEL.to(UPPER_CAMEL, descriptor.methodName()));
内容来源于网络,如有侵权,请联系作者删除!