com.squareup.javapoet.ClassName.reflectionName()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中com.squareup.javapoet.ClassName.reflectionName()方法的一些代码示例,展示了ClassName.reflectionName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassName.reflectionName()方法的具体详情如下:
包路径:com.squareup.javapoet.ClassName
类名称:ClassName
方法名:reflectionName

ClassName.reflectionName介绍

[英]Return the binary name of a class.
[中]

代码示例

代码示例来源:origin: square/javapoet

/** Return the binary name of a class. */
public String reflectionName() {
 return enclosingClassName != null
   ? (enclosingClassName.reflectionName() + '$' + simpleName)
   : (packageName.isEmpty() ? simpleName : packageName + '.' + simpleName);
}

代码示例来源:origin: airbnb/epoxy

static Class<?> getClass(ClassName name) {
 try {
  return Class.forName(name.reflectionName());
 } catch (ClassNotFoundException | NoClassDefFoundError e) {
  return null;
 }
}

代码示例来源:origin: airbnb/epoxy

static TypeElement getElementByName(ClassName name, Elements elements, Types types) {
 String canonicalName = name.reflectionName().replace("$", ".");
 return (TypeElement) getElementByName(canonicalName, elements, types);
}

代码示例来源:origin: airbnb/epoxy

static boolean isType(TypeMirror type, ClassName className) {
 return isType(type, className.reflectionName());
}

代码示例来源:origin: airbnb/epoxy

@Override
public Set<String> getSupportedAnnotationTypes() {
 Set<String> types = new LinkedHashSet<>();
 types.add(EpoxyModelClass.class.getCanonicalName());
 types.add(EpoxyAttribute.class.getCanonicalName());
 types.add(PackageEpoxyConfig.class.getCanonicalName());
 types.add(AutoModel.class.getCanonicalName());
 types.add(EpoxyDataBindingLayouts.class.getCanonicalName());
 types.add(EpoxyDataBindingPattern.class.getCanonicalName());
 types.add(ModelView.class.getCanonicalName());
 types.add(PackageModelViewConfig.class.getCanonicalName());
 types.add(TextProp.class.getCanonicalName());
 types.add(CallbackProp.class.getCanonicalName());
 types.add(ClassNames.LITHO_ANNOTATION_LAYOUT_SPEC.reflectionName());
 return types;
}

代码示例来源:origin: airbnb/epoxy

String rLayoutClassString = rClassName.reflectionName();
if (!rLayoutClassString.endsWith(".R")
  && !rLayoutClassString.endsWith(".R2")) {

代码示例来源:origin: evernote/android-state

} else {
  ClassName rawType = ClassName.bestGuess(eraseGenericIfNecessary(superType).toString() + STATE_SAVER_SUFFIX);
  if (!rawType.toString().equals(rawType.reflectionName())) {
    rawType = ClassName.bestGuess(rawType.reflectionName());

代码示例来源:origin: VueGWT/vue-gwt

public boolean isReturnString() {
 if (!(type instanceof ClassName)) {
  return false;
 }
 ClassName className = (ClassName) type;
 return className.reflectionName().equals("String") || className
   .reflectionName()
   .equals(String.class.getCanonicalName());
}

代码示例来源:origin: ppdai-incubator/raptor

private Object defaultRequestPath(Rpc rpc, ClassName className) {
  ArrayList<String> params = Lists.newArrayList(RaptorConstants.RAPTOR, className.reflectionName(), rpc.name());
  return RaptorConstants.PATH_SEPARATOR + StringUtils.join(params, RaptorConstants.PATH_SEPARATOR);
}

代码示例来源:origin: derive4j/derive4j

@Override
public Optional<TypeElement> findTypeElement(ClassName cn) {
 return Optional.ofNullable(elements().getTypeElement(cn.reflectionName().replace("$", ".")));
}

代码示例来源:origin: kevelbreh/journey

private boolean extendsController(Element element) {
 TypeMirror target = elementUtils.getTypeElement(CONDUCTOR_CONTROLLER.reflectionName()).asType();
 TypeMirror mirror = element.asType();
 while (mirror.getKind() != TypeKind.NONE) {
  if (typeUtils.isSameType(target, mirror)) {
   return true;
  }
  mirror = ((TypeElement) typeUtils.asElement(mirror)).getSuperclass();
 }
 return false;
}

代码示例来源:origin: org.derive4j/derive4j

@Override
public Optional<TypeElement> findTypeElement(ClassName cn) {
 return Optional.ofNullable(elements().getTypeElement(cn.reflectionName().replace("$", ".")));
}

代码示例来源:origin: VueGWT/vue-gwt

public static void toJavaFile(Filer filer, Builder classBuilder, ClassName className,
  TypeElement... originatingElement) {
 try {
  JavaFile javaFile =
    JavaFile.builder(className.packageName(), classBuilder.build()).build();
  JavaFileObject javaFileObject =
    filer.createSourceFile(className.reflectionName(), originatingElement);
  Writer writer = javaFileObject.openWriter();
  javaFile.writeTo(writer);
  writer.close();
 } catch (IOException e) {
  e.printStackTrace();
 }
}

代码示例来源:origin: VueGWT/vue-gwt

public static ClassName nameWithSuffix(ClassName className, String suffix) {
 return nameWithSuffix(className.reflectionName(), suffix);
}

代码示例来源:origin: com.commercetools.sdk.jvm.core/commercetools-internal-processors

private boolean isListProperty(final PropertyGenModel propertyGenModel){
  final boolean isParmetrizedList = (propertyGenModel.getType() instanceof ParameterizedTypeName) && ((ParameterizedTypeName)propertyGenModel.getType()).rawType.reflectionName().equals(List.class.getTypeName());
  final boolean isNonParmetrizedList = (propertyGenModel.getType() instanceof ClassName) && ((ClassName)propertyGenModel.getType()).reflectionName().equals(List.class.getTypeName());
  return isNonParmetrizedList || isParmetrizedList;
}

代码示例来源:origin: com.commercetools.sdk.jvm.core/commercetools-internal-processors

private boolean isSetProperty(final PropertyGenModel propertyGenModel){
  final boolean isParmetrizedSet = (propertyGenModel.getType() instanceof ParameterizedTypeName) && ((ParameterizedTypeName)propertyGenModel.getType()).rawType.reflectionName().equals(Set.class.getTypeName());
  final boolean isNonParmetrizedSet = (propertyGenModel.getType() instanceof ClassName) && ((ClassName)propertyGenModel.getType()).reflectionName().equals(Set.class.getTypeName());
  return isNonParmetrizedSet || isParmetrizedSet;
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

private boolean isListProperty(final PropertyGenModel propertyGenModel){
  final boolean isParmetrizedList = (propertyGenModel.getType() instanceof ParameterizedTypeName) && ((ParameterizedTypeName)propertyGenModel.getType()).rawType.reflectionName().equals(List.class.getTypeName());
  final boolean isNonParmetrizedList = (propertyGenModel.getType() instanceof ClassName) && ((ClassName)propertyGenModel.getType()).reflectionName().equals(List.class.getTypeName());
  return isNonParmetrizedList || isParmetrizedList;
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

private boolean isSetProperty(final PropertyGenModel propertyGenModel){
  final boolean isParmetrizedSet = (propertyGenModel.getType() instanceof ParameterizedTypeName) && ((ParameterizedTypeName)propertyGenModel.getType()).rawType.reflectionName().equals(Set.class.getTypeName());
  final boolean isNonParmetrizedSet = (propertyGenModel.getType() instanceof ClassName) && ((ClassName)propertyGenModel.getType()).reflectionName().equals(Set.class.getTypeName());
  return isNonParmetrizedSet || isParmetrizedSet;
}

代码示例来源:origin: VueGWT/vue-gwt

private Optional<TemplateFileResource> getTemplateContent(ClassName componentTypeName,
  TypeElement componentTypeElement) {
 String path = slashify(componentTypeName.reflectionName()) + ".html";
 Optional<TemplateFileResource> result = getTemplateContentAtLocation(path,
   StandardLocation.CLASS_OUTPUT);
 if (result.isPresent()) {
  return result;
 }
 result = getTemplateContentAtLocation(path, StandardLocation.CLASS_PATH);
 if (result.isPresent()) {
  return result;
 }
 messager.printMessage(Kind.ERROR,
   "Couldn't find template for component: "
     + componentTypeName.simpleName()
     + ". Make sure you included src/main/java in your Resources. Check our setup guide for help.",
   componentTypeElement);
 return Optional.empty();
}

代码示例来源:origin: com.google.dagger/dagger-compiler

"$T.of($S)",
ClassName.get("dagger.android.internal", "AndroidInjectionKeys"),
ClassName.get(unwrappedType).reflectionName());

相关文章