Java Code Examples for com.sun.codemodel.JClass#name()
The following examples show how to use
com.sun.codemodel.JClass#name() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RamlTypeHelper.java From springmvc-raml-plugin with Apache License 2.0 | 5 votes |
/** * Maps a RAML Data Type to a JCodeModel using JSONSchema2Pojo and * encapsulates it along with some metadata into an {@link ApiBodyMetadata} * object. * * @param pojoCodeModel * The code model containing the classes generated during * generation * @param document * The Raml document being parsed * @param type * The RAML type declaration * @return Object representing this Body */ public static ApiBodyMetadata mapTypeToPojo(JCodeModel pojoCodeModel, RamlRoot document, TypeDeclaration type) { RamlInterpretationResult interpret = RamlInterpreterFactory.getInterpreterForType(type).interpret(document, type, pojoCodeModel, false); // here we expect that a new object is created i guess... we'd need to // see how primitive arrays fit in JClass pojo = null; if (interpret.getBuilder() != null) { pojo = interpret.getBuilder().getPojo(); } else if (interpret.getResolvedClass() != null) { pojo = interpret.getResolvedClass(); } if (pojo == null) { throw new IllegalStateException("No Pojo created or resolved for type " + type.getClass().getSimpleName() + ":" + type.name()); } if (pojo.name().equals("Void")) { return null; } boolean array = false; String pojoName = pojo.name(); if (pojo.name().contains("List<") || pojo.name().contains("Set<")) { array = true; pojoName = pojo.getTypeParameters().get(0).name(); } return new ApiBodyMetadata(pojoName, type, array, pojoCodeModel); }
Example 2
Source File: CodeModelUtils.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 4 votes |
public static String getClassName(final JClass theClass) { return (theClass.outer() == null ? theClass.fullName() : getClassName(theClass.outer()) + "$" + theClass.name()); }
Example 3
Source File: CodeModelUtils.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 4 votes |
public static String getLocalClassName(final JClass theClass) { return (theClass.outer() == null ? theClass.name() : getLocalClassName(theClass.outer()) + "$" + theClass.name()); }
Example 4
Source File: CodeModelUtils.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 4 votes |
public static String getDottedLocalClassName(final JClass theClass) { return (theClass.outer() == null ? theClass.name() : getDottedLocalClassName(theClass.outer()) + "." + theClass.name()); }
Example 5
Source File: CodeModelUtils.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 4 votes |
public static String getPackagedClassName(final JClass theClass) { return (theClass.outer() == null ? theClass.fullName() : getPackagedClassName(theClass.outer()) + "$" + theClass.name()); }
Example 6
Source File: PluginImpl.java From immutable-xjc with MIT License | 4 votes |
private String getBuilderClassName(JClass clazz) { if (isUseSimpleBuilderName()) { return "Builder"; } return clazz.name() + "Builder"; }