本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}