當前位置: 首頁>>代碼示例>>Java>>正文


Java Modifiers類代碼示例

本文整理匯總了Java中com.workday.meta.Modifiers的典型用法代碼示例。如果您正苦於以下問題:Java Modifiers類的具體用法?Java Modifiers怎麽用?Java Modifiers使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Modifiers類屬於com.workday.meta包,在下文中一共展示了Modifiers類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writeMapField

import com.workday.meta.Modifiers; //導入依賴的package包/類
private void writeMapField(JavaWriter writer) throws IOException {
    writer.emitField(MAP_TYPE, "MAP", Modifiers.PRIVATE_CONSTANT,
                     String.format("new HashMap<Class<?>, %s<?>>()",
                                   InstanceUpdater.class.getSimpleName()));

    writer.beginInitializer(true);

    for (Map.Entry<String, String> entry : classNameToParserNameMap.entrySet()) {
        String className = entry.getKey();
        String parserQualifiedName = entry.getValue();
        TypeElement parserType =
                processingEnv.getElementUtils().getTypeElement(parserQualifiedName);
        if (parserType == null
                || metaTypes.isSubtypeErasure(parserType.asType(), InstanceUpdater.class)) {
            writer.emitStatement("MAP.put(%s.class, %s.INSTANCE)",
                                 className,
                                 parserQualifiedName);
        }
    }

    writer.endInitializer();
}
 
開發者ID:Workday,項目名稱:autoparse-json,代碼行數:23,代碼來源:InstanceUpdaterTableGenerator.java

示例2: writePostCreateCollectionMethod

import com.workday.meta.Modifiers; //導入依賴的package包/類
@Override
public void writePostCreateCollectionMethod(JavaWriter writer) throws IOException {
    String collectionType = writer.compressType(JavaWriter.type(Collection.class, "?"));

    writer.beginMethod("void",
                       "onPostCreateCollection",
                       Modifiers.PRIVATE,
                       parentType,
                       "parent",
                       collectionType,
                       "collection");
    writer.beginControlFlow("for (Object o : collection)");
    writeItemSwitch(writer, "parent", "o");
    writer.endControlFlow();
    writer.endMethod();
}
 
開發者ID:Workday,項目名稱:autoparse-json,代碼行數:17,代碼來源:StandardPostCreateChildBlockWriter.java

示例3: writePostCreateMapMethod

import com.workday.meta.Modifiers; //導入依賴的package包/類
@Override
public void writePostCreateMapMethod(JavaWriter writer) throws IOException {
    String mapType = writer.compressType(JavaWriter.type(Map.class, "?", "?"));

    writer.beginMethod("void",
                       "onPostCreateMap",
                       Modifiers.PRIVATE,
                       parentType,
                       "parent",
                       mapType,
                       "map");
    writer.beginControlFlow("for (Object o : map.values())");
    writeItemSwitch(writer, "parent", "o");
    writer.endControlFlow();
    writer.endMethod();

}
 
開發者ID:Workday,項目名稱:autoparse-json,代碼行數:18,代碼來源:StandardPostCreateChildBlockWriter.java

示例4: writeWriteToParcelMethod

import com.workday.meta.Modifiers; //導入依賴的package包/類
private void writeWriteToParcelMethod(JavaWriter writer) throws IOException {
    List<String> parameters = new ArrayList<>(4);
    parameters.add(elementCompressedName);
    parameters.add("object");
    parameters.add("Parcel");
    parameters.add("dest");

    writer.emitAnnotation(Override.class);
    writer.beginMethod("void", "writeToParcel", Modifiers.PUBLIC, parameters, null);
    writer.emitStatement("Bundle bundle = new Bundle()");

    for (VariableElement field : parceledFields) {
        getSaveStatementWriter(field).writeFieldWriteStatement(field, writer);
    }

    writer.emitStatement("dest.writeBundle(bundle)");
    writer.endMethod();
}
 
開發者ID:Workday,項目名稱:postman,代碼行數:19,代碼來源:ParcelerGenerator.java

示例5: writeReadFromParcelMethod

import com.workday.meta.Modifiers; //導入依賴的package包/類
private void writeReadFromParcelMethod(JavaWriter writer) throws IOException {
    writer.emitAnnotation(Override.class);
    writer.beginMethod(elementCompressedName, "readFromParcel", Modifiers.PUBLIC, "Parcel",
                       "parcel");

    writer.emitStatement("%s object = new %s()", elementCompressedName, elementCompressedName);
    writer.emitStatement("Bundle bundle = parcel.readBundle()");
    writer.emitStatement("bundle.setClassLoader(%s.class.getClassLoader())",
                         elementCompressedName);
    for (VariableElement field : parceledFields) {
        getSaveStatementWriter(field).writeFieldReadStatement(field,
                                                              postCreateChildMethods,
                                                              writer);
    }
    writer.emitStatement("return object");
    writer.endMethod();
}
 
開發者ID:Workday,項目名稱:postman,代碼行數:18,代碼來源:ParcelerGenerator.java

示例6: writeMapField

import com.workday.meta.Modifiers; //導入依賴的package包/類
private void writeMapField(JavaWriter writer) throws IOException {
    writer.emitField(MAP_TYPE, "MAP", Modifiers.PRIVATE_CONSTANT,
                     String.format("new HashMap<String, %s<?>>()",
                                   XmlElementParser.class.getSimpleName()));

    writer.beginInitializer(true);
    for (Map.Entry<String, TypeElement> entry : parseMap.entrySet()) {
        writer.emitStatement("MAP.put(\"%s\", %s.INSTANCE)", entry.getKey(),
                             entry.getValue().getSimpleName()
                                     + GeneratedClassNames.PARSER_SUFFIX);
    }
    writer.endInitializer();
}
 
開發者ID:Workday,項目名稱:autoparse-xml,代碼行數:14,代碼來源:ParserMapGenerator.java

示例7: writeKeySet

import com.workday.meta.Modifiers; //導入依賴的package包/類
private void writeKeySet(JavaWriter writer) throws IOException {

        writer.emitAnnotation(Override.class);
        writer.beginMethod(JavaWriter.type(Set.class, "String"), "keySet", Modifiers.PUBLIC);
        writer.emitStatement("return MAP.keySet()");
        writer.endMethod();
    }
 
開發者ID:Workday,項目名稱:autoparse-xml,代碼行數:8,代碼來源:ParserMapGenerator.java

示例8: writeGetter

import com.workday.meta.Modifiers; //導入依賴的package包/類
private void writeGetter(JavaWriter writer) throws IOException {
    writer.emitAnnotation(Override.class);
    writer.beginMethod(JavaWriter.type(JsonObjectParser.class, "?"),
                       "get",
                       Modifiers.PUBLIC,
                       "String",
                       "discriminationValue");
    writer.emitStatement("return MAP.get(discriminationValue)");
    writer.endMethod();
}
 
開發者ID:Workday,項目名稱:autoparse-json,代碼行數:11,代碼來源:JsonObjectParserTableGenerator.java

示例9: writeUpdateFromMapMethod

import com.workday.meta.Modifiers; //導入依賴的package包/類
private void writeUpdateFromMapMethod(JavaWriter writer) throws IOException {
    writer.emitAnnotation(Override.class);
    writer.emitAnnotation(SuppressWarnings.class, JavaWriter.stringLiteral("rawtypes"));
    List<String> parameters = CollectionUtils.newArrayList(parsedClassName, "instance",
                                                           JavaWriter.type(Map.class, "String", "Object"), "map",
                                                           JsonParserContext.class.getSimpleName(), "context");

    writer.beginMethod("void", "updateInstanceFromMap", Modifiers.PUBLIC, parameters, null);

    writeUpdateAssignmentsBlock(writer);
    if (selfValueAssignmentInfo != null) {
        writeUpdateSelfValuesBlock(writer);
    }
    writer.endMethod();
}
 
開發者ID:Workday,項目名稱:autoparse-json,代碼行數:16,代碼來源:JsonObjectParserGenerator.java

示例10: writeInitializeAndGetFieldMethod

import com.workday.meta.Modifiers; //導入依賴的package包/類
private void writeInitializeAndGetFieldMethod(JavaWriter writer) throws IOException {
    writer.emitAnnotation(Override.class);
    writer.beginMethod("Object", "initializeAndGetField", Modifiers.PUBLIC, parsedClassName, "instance", "String",
                       "name");
    writer.emitStatement("return doInitializeAndGetField(instance, name, true)");
    writer.endMethod();
}
 
開發者ID:Workday,項目名稱:autoparse-json,代碼行數:8,代碼來源:JsonObjectParserGenerator.java

示例11: writeDoInitializeAndGetFieldMethod

import com.workday.meta.Modifiers; //導入依賴的package包/類
private void writeDoInitializeAndGetFieldMethod(JavaWriter writer) throws IOException {
    writer.beginMethod("Object", "doInitializeAndGetField", Modifiers.PRIVATE, parsedClassName, "instance",
                       "String", "name", "boolean", "initializeCollections");
    writer.beginControlFlow("switch (name)");
    for (AssignmentInfo assignmentInfo : assignments) {
        if (assignmentInfo.member instanceof VariableElement) {
            writeInitializeAndGetBlock(writer, (VariableElement) assignmentInfo.member, assignmentInfo.name);
        }
    }
    writer.beginControlFlow("default:");
    writer.emitStatement("return null");
    writer.endControlFlow();
    writer.endControlFlow();
    writer.endMethod();
}
 
開發者ID:Workday,項目名稱:autoparse-json,代碼行數:16,代碼來源:JsonObjectParserGenerator.java

示例12: writeGetter

import com.workday.meta.Modifiers; //導入依賴的package包/類
private void writeGetter(JavaWriter writer) throws IOException {
    writer.emitAnnotation(Override.class);
    writer.emitAnnotation(SuppressWarnings.class, JavaWriter.stringLiteral("unchecked"));
    writer.beginMethod("<T>" + JavaWriter.type(InstanceUpdater.class, "T"),
                       "getInstanceUpdaterForClass",
                       Modifiers.PUBLIC,
                       "Class<T>",
                       "clazz");
    writer.emitStatement("return (InstanceUpdater<T>) MAP.get(clazz)");
    writer.endMethod();
}
 
開發者ID:Workday,項目名稱:autoparse-json,代碼行數:12,代碼來源:InstanceUpdaterTableGenerator.java

示例13: writePostCreateChildMethod

import com.workday.meta.Modifiers; //導入依賴的package包/類
@Override
public void writePostCreateChildMethod(JavaWriter writer) throws IOException {
    writer.beginMethod("void",
                       "onPostCreateChild",
                       Modifiers.PRIVATE,
                       parentType,
                       "parent",
                       "Object",
                       "child");
    for (ExecutableElement method : postCreateChildMethods) {
        writer.emitStatement("parent.%s(child)", method.getSimpleName());
    }
    writer.endMethod();
}
 
開發者ID:Workday,項目名稱:autoparse-json,代碼行數:15,代碼來源:StandardPostCreateChildBlockWriter.java

示例14: writeNewArrayMethod

import com.workday.meta.Modifiers; //導入依賴的package包/類
private void writeNewArrayMethod(JavaWriter writer) throws IOException {
    writer.emitAnnotation(Override.class);
    writer.beginMethod(String.format("%s[]", elementCompressedName),
                       "newArray",
                       Modifiers.PUBLIC,
                       "int",
                       "size");
    writer.emitStatement("return new %s[size]", elementCompressedName);
    writer.endMethod();
}
 
開發者ID:Workday,項目名稱:postman,代碼行數:11,代碼來源:ParcelerGenerator.java

示例15: writeKeySet

import com.workday.meta.Modifiers; //導入依賴的package包/類
private void writeKeySet(JavaWriter writer) throws IOException {
    writer.emitAnnotation(Override.class);
    writer.beginMethod(JavaWriter.type(Set.class, "String"), "keySet", Modifiers.PUBLIC);
    writer.emitStatement("return MAP.keySet()");
    writer.endMethod();
}
 
開發者ID:Workday,項目名稱:autoparse-json,代碼行數:7,代碼來源:JsonObjectParserTableGenerator.java


注:本文中的com.workday.meta.Modifiers類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。