當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。