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

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

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

ClassName.box介绍

暂无

代码示例

代码示例来源:origin: facebook/litho

stateContainerClassBuilder.addField(
  FieldSpec.builder(
      ParameterizedTypeName.get(ClassNames.LIST, specModel.getTransitionClass().box()),
      GeneratorConstants.STATE_TRANSITIONS_FIELD_NAME)
    .initializer("new $T<>()", ClassNames.ARRAY_LIST)
    .addAnnotation(Override.class)
    .returns(
      ParameterizedTypeName.get(ClassNames.LIST, specModel.getTransitionClass().box()))
    .addCode(
      CodeBlock.builder()

代码示例来源:origin: com.progressoft.brix.domino.apt/apt-server

@Override
protected void registerItem(EndpointsEntry entry, MethodSpec.Builder methodBuilder) {
  final FullClassName handlerEndpoint = new FullClassName(entry.element.fullQualifiedNoneGenericName() + "EndpointHandler");
  String path = entry.element.getAnnotation(Handler.class).value();
  ClassName handlerEndpointType = ClassName.get(handlerEndpoint.asPackage(), handlerEndpoint.asSimpleName());
  MethodSpec getMethod = MethodSpec.methodBuilder("get")
      .addAnnotation(Override.class)
      .addModifiers(Modifier.PUBLIC)
      .returns(handlerEndpointType)
      .addStatement("return new $T()", handlerEndpointType)
      .build();
  TypeSpec factoryType = TypeSpec.anonymousClassBuilder("")
      .addSuperinterface(ParameterizedTypeName.get(ClassName.get(Supplier.class), handlerEndpointType.box()))
      .addMethod(getMethod)
      .build();
  methodBuilder.addStatement("registry.registerEndpoint(\"" + path + "\", $L)", factoryType);
}

代码示例来源:origin: izumin5210/Droidux

public static ParameterSpec getParameterSpec(ClassName className, Modifier... modifiers) {
  return ParameterSpec.builder(
      className.box(),
      getLowerCamelFromUpperCamel(className.simpleName()),
      modifiers
  ).build();
}

相关文章