当前位置: 首页>>代码示例>>Java>>正文


Java FieldSpec.builder方法代码示例

本文整理汇总了Java中com.squareup.javapoet.FieldSpec.builder方法的典型用法代码示例。如果您正苦于以下问题:Java FieldSpec.builder方法的具体用法?Java FieldSpec.builder怎么用?Java FieldSpec.builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.squareup.javapoet.FieldSpec的用法示例。


在下文中一共展示了FieldSpec.builder方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addFields

import com.squareup.javapoet.FieldSpec; //导入方法依赖的package包/类
private void addFields(final TypeSpec.Builder classBuilder) {
    FieldSpec.Builder viewIdsField = FieldSpec.builder(int[].class, "viewIds", Modifier.PRIVATE, Modifier.STATIC,
            Modifier.FINAL);
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    for (Integer id : viewIds) {
        sb.append(id).append(",");
    }

    if (viewIds.size() > 0) {
        sb.deleteCharAt(sb.length() - 1);
    }

    sb.append("}");
    viewIdsField.initializer(CodeBlock.of(sb.toString()));
    classBuilder.addField(viewIdsField.build());

}
 
开发者ID:renard314,项目名称:auto-adapter,代码行数:19,代码来源:ViewHolderFactoryGenerator.java

示例2: createMembers

import com.squareup.javapoet.FieldSpec; //导入方法依赖的package包/类
@NonNull
protected FieldSpec[] createMembers() {
    final List<FieldSpec> fields = new ArrayList<>();

    final TypeName typeOfField = TypeName.get(type.element.asType());
    final FieldSpec.Builder builder = FieldSpec.builder(typeOfField, "inner", Modifier.PROTECTED, Modifier.FINAL);
    fields.add(builder.build());

    return fields.toArray(new FieldSpec[0]);
}
 
开发者ID:OleksandrKucherenko,项目名称:autoproxy,代码行数:11,代码来源:CommonClassGenerator.java

示例3: buildProviderField

import com.squareup.javapoet.FieldSpec; //导入方法依赖的package包/类
private static FieldSpec.Builder buildProviderField( final @Nonnull ComponentDescriptor descriptor )
{
  return FieldSpec.builder( ParameterizedTypeName.get( PROVIDER_CLASSNAME,
                                                       TypeName.get( descriptor.getDeclaredType() ) ),
                            "c_provider",
                            Modifier.STATIC,
                            Modifier.PRIVATE );
}
 
开发者ID:react4j,项目名称:react4j,代码行数:9,代码来源:Generator.java

示例4: create

import com.squareup.javapoet.FieldSpec; //导入方法依赖的package包/类
public FieldSpec create(Column column, VariableElement element, TypeElement entityClass) {
    ColumnType columnType = ColumnType.fromVariable(element);
    ParameterizedTypeName typeName = ParameterizedTypeName.get(ClassName.get(columnType.getColumnClass()), ClassName.get(entityClass));
    String fieldName = NamingUtils.columnFieldName(element.getSimpleName().toString());
    FieldSpec.Builder builder = FieldSpec.builder(typeName, fieldName, Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL);
    builder.initializer("$T.$N($T.class, $S)", DbColumn.class, columnType.getFactoryMethod(), ClassName.get(entityClass), column.value());
    return builder.build();
}
 
开发者ID:orekyuu,项目名称:Moco,代码行数:9,代码来源:ColumnFieldFactory.java

示例5: createFieldBuilder

import com.squareup.javapoet.FieldSpec; //导入方法依赖的package包/类
@Override
public FieldSpec.Builder[] createFieldBuilder(String pkgName, String interName, String classname,
                                              List<FieldData> datas, int superInterfaceFlagsForParent) {
    //if parent handled.
    if(Util.hasFlag(superInterfaceFlagsForParent, FieldData.FLAG_SELECTABLE)){
        return null;
    }
    return new FieldSpec.Builder[]{
            FieldSpec.builder(TypeName.BOOLEAN, FD_SELECTABLE.getPropertyName(), Modifier.PRIVATE),
    };
}
 
开发者ID:LightSun,项目名称:data-mediator,代码行数:12,代码来源:TypeSelectableFiller.java

示例6: asField

import com.squareup.javapoet.FieldSpec; //导入方法依赖的package包/类
public FieldSpec asField(MemberModel memberModel, Modifier... modifiers) {
    FieldSpec.Builder builder = FieldSpec.builder(typeProvider.fieldType(memberModel),
                                                  memberModel.getVariable().getVariableName());

    if (modifiers != null) {
        builder.addModifiers(modifiers);
    }

    return builder.build();
}
 
开发者ID:aws,项目名称:aws-sdk-java-v2,代码行数:11,代码来源:ShapeModelSpec.java

示例7: privateField

import com.squareup.javapoet.FieldSpec; //导入方法依赖的package包/类
public static FieldSpec.Builder privateField(Type fType, String name) {
    return FieldSpec.builder(fType, name, Modifier.PRIVATE);
}
 
开发者ID:c0d3d,项目名称:easy-plugins,代码行数:4,代码来源:Util.java

示例8: addFields

import com.squareup.javapoet.FieldSpec; //导入方法依赖的package包/类
private void addFields(final TypeSpec.Builder builder, final ClassName dataBindingName) {
    FieldSpec.Builder field = FieldSpec.builder(dataBindingName, "binding", Modifier.PRIVATE, Modifier.FINAL);
    builder.addField(field.build());
}
 
开发者ID:renard314,项目名称:auto-adapter,代码行数:5,代码来源:ViewBinderGenerator.java


注:本文中的com.squareup.javapoet.FieldSpec.builder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。