com.sun.codemodel.internal.JMod Java Examples
The following examples show how to use
com.sun.codemodel.internal.JMod.
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: ServiceGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private void writeGetPort(Port port, JType retType, JDefinedClass cls) { JMethod m = cls.method(JMod.PUBLIC, retType, port.getPortGetter()); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); JCommentPart paramDoc = methodDoc.addParam("features"); paramDoc.append("A list of "); paramDoc.append("{@link " + WebServiceFeature.class.getName() + "}"); paramDoc.append("to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values."); ret.add("returns " + retType.name()); m.varParam(WebServiceFeature.class, "features"); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class, features);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
Example #2
Source File: SourceLocationAddOn.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public boolean run( Outline outline, Options opt, ErrorHandler errorHandler ) { for( ClassOutline ci : outline.getClasses() ) { JDefinedClass impl = ci.implClass; if (ci.getSuperClass() == null) { JVar $loc = impl.field(JMod.PROTECTED, Locator.class, fieldName); $loc.annotate(XmlLocation.class); $loc.annotate(XmlTransient.class); impl._implements(Locatable.class); impl.method(JMod.PUBLIC, Locator.class, "sourceLocation").body()._return($loc); JMethod setter = impl.method(JMod.PUBLIC, Void.TYPE, "setSourceLocation"); JVar $newLoc = setter.param(Locator.class, "newLocator"); setter.body().assign($loc, $newLoc); } } return true; }
Example #3
Source File: ServiceGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void writeDefaultGetPort(Port port, JType retType, JDefinedClass cls) { String portGetter = port.getPortGetter(); JMethod m = cls.method(JMod.PUBLIC, retType, portGetter); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); ret.add("returns " + retType.name()); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
Example #4
Source File: WebServiceWrapperGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void writeMember(JDefinedClass cls, TypeMirror paramType, String paramName) { if (cls == null) return; String accessorName =BindingHelper.mangleNameToPropertyName(paramName); String getterPrefix = paramType.toString().equals("boolean")? "is" : "get"; JType propType = getType(paramType); JMethod m = cls.method(JMod.PUBLIC, propType, getterPrefix+ accessorName); JDocComment methodDoc = m.javadoc(); JCommentPart ret = methodDoc.addReturn(); ret.add("returns "+propType.name()); JBlock body = m.body(); body._return( JExpr._this().ref(paramName) ); m = cls.method(JMod.PUBLIC, cm.VOID, "set"+accessorName); JVar param = m.param(propType, paramName); methodDoc = m.javadoc(); JCommentPart part = methodDoc.addParam(paramName); part.add("the value for the "+ paramName+" property"); body = m.body(); body.assign( JExpr._this().ref(paramName), param ); }
Example #5
Source File: ObjectFactoryGeneratorImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * return a JFieldVar that represents the QName field for the given information. * * if it doesn't exist, create a static field in the class and store a new JFieldVar. */ private JExpression getQNameInvocation(CElementInfo ei) { QName name = ei.getElementName(); if(qnameMap.containsKey(name)) { return qnameMap.get(name); } if(qnameMap.size()>1024) // stop gap measure to avoid 'code too large' error in javac. return createQName(name); // [RESULT] // private static final QName _XYZ_NAME = new QName("uri", "local"); JFieldVar qnameField = objectFactory.field( JMod.PRIVATE | JMod.STATIC | JMod.FINAL, QName.class, '_' + ei.getSqueezedName() + "_QNAME", createQName(name)); qnameMap.put(name, qnameField); return qnameField; }
Example #6
Source File: ServiceGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private void writeDefaultGetPort(Port port, JType retType, JDefinedClass cls) { String portGetter = port.getPortGetter(); JMethod m = cls.method(JMod.PUBLIC, retType, portGetter); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); ret.add("returns " + retType.name()); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
Example #7
Source File: SourceLocationAddOn.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public boolean run( Outline outline, Options opt, ErrorHandler errorHandler ) { for( ClassOutline ci : outline.getClasses() ) { JDefinedClass impl = ci.implClass; if (ci.getSuperClass() == null) { JVar $loc = impl.field(JMod.PROTECTED, Locator.class, fieldName); $loc.annotate(XmlLocation.class); $loc.annotate(XmlTransient.class); impl._implements(Locatable.class); impl.method(JMod.PUBLIC, Locator.class, "sourceLocation").body()._return($loc); JMethod setter = impl.method(JMod.PUBLIC, Void.TYPE, "setSourceLocation"); JVar $newLoc = setter.param(Locator.class, "newLocator"); setter.body().assign($loc, $newLoc); } } return true; }
Example #8
Source File: ServiceGenerator.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private void writeDefaultGetPort(Port port, JType retType, JDefinedClass cls) { String portGetter = port.getPortGetter(); JMethod m = cls.method(JMod.PUBLIC, retType, portGetter); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); ret.add("returns " + retType.name()); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
Example #9
Source File: ServiceGenerator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private void writeDefaultGetPort(Port port, JType retType, JDefinedClass cls) { String portGetter = port.getPortGetter(); JMethod m = cls.method(JMod.PUBLIC, retType, portGetter); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); ret.add("returns " + retType.name()); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
Example #10
Source File: WebServiceWrapperGenerator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private void writeMember(JDefinedClass cls, TypeMirror paramType, String paramName) { if (cls == null) return; String accessorName =BindingHelper.mangleNameToPropertyName(paramName); String getterPrefix = paramType.toString().equals("boolean")? "is" : "get"; JType propType = getType(paramType); JMethod m = cls.method(JMod.PUBLIC, propType, getterPrefix+ accessorName); JDocComment methodDoc = m.javadoc(); JCommentPart ret = methodDoc.addReturn(); ret.add("returns "+propType.name()); JBlock body = m.body(); body._return( JExpr._this().ref(paramName) ); m = cls.method(JMod.PUBLIC, cm.VOID, "set"+accessorName); JVar param = m.param(propType, paramName); methodDoc = m.javadoc(); JCommentPart part = methodDoc.addParam(paramName); part.add("the value for the "+ paramName+" property"); body = m.body(); body.assign( JExpr._this().ref(paramName), param ); }
Example #11
Source File: WebServiceWrapperGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private void writeMember(JDefinedClass cls, TypeMirror paramType, String paramName) { if (cls == null) return; String accessorName =BindingHelper.mangleNameToPropertyName(paramName); String getterPrefix = paramType.toString().equals("boolean")? "is" : "get"; JType propType = getType(paramType); JMethod m = cls.method(JMod.PUBLIC, propType, getterPrefix+ accessorName); JDocComment methodDoc = m.javadoc(); JCommentPart ret = methodDoc.addReturn(); ret.add("returns "+propType.name()); JBlock body = m.body(); body._return( JExpr._this().ref(paramName) ); m = cls.method(JMod.PUBLIC, cm.VOID, "set"+accessorName); JVar param = m.param(propType, paramName); methodDoc = m.javadoc(); JCommentPart part = methodDoc.addParam(paramName); part.add("the value for the "+ paramName+" property"); body = m.body(); body.assign( JExpr._this().ref(paramName), param ); }
Example #12
Source File: ObjectFactoryGeneratorImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * return a JFieldVar that represents the QName field for the given information. * * if it doesn't exist, create a static field in the class and store a new JFieldVar. */ private JExpression getQNameInvocation(CElementInfo ei) { QName name = ei.getElementName(); if(qnameMap.containsKey(name)) { return qnameMap.get(name); } if(qnameMap.size()>1024) // stop gap measure to avoid 'code too large' error in javac. return createQName(name); // [RESULT] // private static final QName _XYZ_NAME = new QName("uri", "local"); JFieldVar qnameField = objectFactory.field( JMod.PRIVATE | JMod.STATIC | JMod.FINAL, QName.class, '_' + ei.getSqueezedName() + "_QNAME", createQName(name)); qnameMap.put(name, qnameField); return qnameField; }
Example #13
Source File: ServiceGenerator.java From hottub with GNU General Public License v2.0 | 6 votes |
private void writeDefaultGetPort(Port port, JType retType, JDefinedClass cls) { String portGetter = port.getPortGetter(); JMethod m = cls.method(JMod.PUBLIC, retType, portGetter); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); ret.add("returns " + retType.name()); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
Example #14
Source File: SourceLocationAddOn.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public boolean run( Outline outline, Options opt, ErrorHandler errorHandler ) { for( ClassOutline ci : outline.getClasses() ) { JDefinedClass impl = ci.implClass; if (ci.getSuperClass() == null) { JVar $loc = impl.field(JMod.PROTECTED, Locator.class, fieldName); $loc.annotate(XmlLocation.class); $loc.annotate(XmlTransient.class); impl._implements(Locatable.class); impl.method(JMod.PUBLIC, Locator.class, "sourceLocation").body()._return($loc); JMethod setter = impl.method(JMod.PUBLIC, Void.TYPE, "setSourceLocation"); JVar $newLoc = setter.param(Locator.class, "newLocator"); setter.body().assign($loc, $newLoc); } } return true; }
Example #15
Source File: ServiceGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void writeGetPort(Port port, JType retType, JDefinedClass cls) { JMethod m = cls.method(JMod.PUBLIC, retType, port.getPortGetter()); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); JCommentPart paramDoc = methodDoc.addParam("features"); paramDoc.append("A list of "); paramDoc.append("{@link " + WebServiceFeature.class.getName() + "}"); paramDoc.append("to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values."); ret.add("returns " + retType.name()); m.varParam(WebServiceFeature.class, "features"); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class, features);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
Example #16
Source File: SourceLocationAddOn.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public boolean run( Outline outline, Options opt, ErrorHandler errorHandler ) { for( ClassOutline ci : outline.getClasses() ) { JDefinedClass impl = ci.implClass; if (ci.getSuperClass() == null) { JVar $loc = impl.field(JMod.PROTECTED, Locator.class, fieldName); $loc.annotate(XmlLocation.class); $loc.annotate(XmlTransient.class); impl._implements(Locatable.class); impl.method(JMod.PUBLIC, Locator.class, "sourceLocation").body()._return($loc); JMethod setter = impl.method(JMod.PUBLIC, Void.TYPE, "setSourceLocation"); JVar $newLoc = setter.param(Locator.class, "newLocator"); setter.body().assign($loc, $newLoc); } } return true; }
Example #17
Source File: WebServiceWrapperGenerator.java From hottub with GNU General Public License v2.0 | 6 votes |
private void writeMember(JDefinedClass cls, TypeMirror paramType, String paramName) { if (cls == null) return; String accessorName =BindingHelper.mangleNameToPropertyName(paramName); String getterPrefix = paramType.toString().equals("boolean")? "is" : "get"; JType propType = getType(paramType); JMethod m = cls.method(JMod.PUBLIC, propType, getterPrefix+ accessorName); JDocComment methodDoc = m.javadoc(); JCommentPart ret = methodDoc.addReturn(); ret.add("returns "+propType.name()); JBlock body = m.body(); body._return( JExpr._this().ref(paramName) ); m = cls.method(JMod.PUBLIC, cm.VOID, "set"+accessorName); JVar param = m.param(propType, paramName); methodDoc = m.javadoc(); JCommentPart part = methodDoc.addParam(paramName); part.add("the value for the "+ paramName+" property"); body = m.body(); body.assign( JExpr._this().ref(paramName), param ); }
Example #18
Source File: SourceLocationAddOn.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public boolean run( Outline outline, Options opt, ErrorHandler errorHandler ) { for( ClassOutline ci : outline.getClasses() ) { JDefinedClass impl = ci.implClass; if (ci.getSuperClass() == null) { JVar $loc = impl.field(JMod.PROTECTED, Locator.class, fieldName); $loc.annotate(XmlLocation.class); $loc.annotate(XmlTransient.class); impl._implements(Locatable.class); impl.method(JMod.PUBLIC, Locator.class, "sourceLocation").body()._return($loc); JMethod setter = impl.method(JMod.PUBLIC, Void.TYPE, "setSourceLocation"); JVar $newLoc = setter.param(Locator.class, "newLocator"); setter.body().assign($loc, $newLoc); } } return true; }
Example #19
Source File: ServiceGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private void writeDefaultGetPort(Port port, JType retType, JDefinedClass cls) { String portGetter = port.getPortGetter(); JMethod m = cls.method(JMod.PUBLIC, retType, portGetter); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); ret.add("returns " + retType.name()); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
Example #20
Source File: WebServiceWrapperGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private void writeMember(JDefinedClass cls, TypeMirror paramType, String paramName) { if (cls == null) return; String accessorName =BindingHelper.mangleNameToPropertyName(paramName); String getterPrefix = paramType.toString().equals("boolean")? "is" : "get"; JType propType = getType(paramType); JMethod m = cls.method(JMod.PUBLIC, propType, getterPrefix+ accessorName); JDocComment methodDoc = m.javadoc(); JCommentPart ret = methodDoc.addReturn(); ret.add("returns "+propType.name()); JBlock body = m.body(); body._return( JExpr._this().ref(paramName) ); m = cls.method(JMod.PUBLIC, cm.VOID, "set"+accessorName); JVar param = m.param(propType, paramName); methodDoc = m.javadoc(); JCommentPart part = methodDoc.addParam(paramName); part.add("the value for the "+ paramName+" property"); body = m.body(); body.assign( JExpr._this().ref(paramName), param ); }
Example #21
Source File: WebServiceWrapperGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private void writeMember(JDefinedClass cls, TypeMirror paramType, String paramName) { if (cls == null) return; String accessorName =BindingHelper.mangleNameToPropertyName(paramName); String getterPrefix = paramType.toString().equals("boolean")? "is" : "get"; JType propType = getType(paramType); JMethod m = cls.method(JMod.PUBLIC, propType, getterPrefix+ accessorName); JDocComment methodDoc = m.javadoc(); JCommentPart ret = methodDoc.addReturn(); ret.add("returns "+propType.name()); JBlock body = m.body(); body._return( JExpr._this().ref(paramName) ); m = cls.method(JMod.PUBLIC, cm.VOID, "set"+accessorName); JVar param = m.param(propType, paramName); methodDoc = m.javadoc(); JCommentPart part = methodDoc.addParam(paramName); part.add("the value for the "+ paramName+" property"); body = m.body(); body.assign( JExpr._this().ref(paramName), param ); }
Example #22
Source File: ServiceGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private void writeGetPort(Port port, JType retType, JDefinedClass cls) { JMethod m = cls.method(JMod.PUBLIC, retType, port.getPortGetter()); JDocComment methodDoc = m.javadoc(); if (port.getJavaDoc() != null) { methodDoc.add(port.getJavaDoc()); } JCommentPart ret = methodDoc.addReturn(); JCommentPart paramDoc = methodDoc.addParam("features"); paramDoc.append("A list of "); paramDoc.append("{@link " + WebServiceFeature.class.getName() + "}"); paramDoc.append("to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values."); ret.add("returns " + retType.name()); m.varParam(WebServiceFeature.class, "features"); JBlock body = m.body(); StringBuilder statement = new StringBuilder("return "); statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), "); statement.append(retType.name()); statement.append(".class, features);"); body.directStatement(statement.toString()); writeWebEndpoint(port, m); }
Example #23
Source File: WebServiceWrapperGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private void writeMember(JDefinedClass cls, TypeMirror paramType, String paramName) { if (cls == null) return; String accessorName =BindingHelper.mangleNameToPropertyName(paramName); String getterPrefix = paramType.toString().equals("boolean")? "is" : "get"; JType propType = getType(paramType); JMethod m = cls.method(JMod.PUBLIC, propType, getterPrefix+ accessorName); JDocComment methodDoc = m.javadoc(); JCommentPart ret = methodDoc.addReturn(); ret.add("returns "+propType.name()); JBlock body = m.body(); body._return( JExpr._this().ref(paramName) ); m = cls.method(JMod.PUBLIC, cm.VOID, "set"+accessorName); JVar param = m.param(propType, paramName); methodDoc = m.javadoc(); JCommentPart part = methodDoc.addParam(paramName); part.add("the value for the "+ paramName+" property"); body = m.body(); body.assign( JExpr._this().ref(paramName), param ); }
Example #24
Source File: SourceLocationAddOn.java From hottub with GNU General Public License v2.0 | 6 votes |
public boolean run( Outline outline, Options opt, ErrorHandler errorHandler ) { for( ClassOutline ci : outline.getClasses() ) { JDefinedClass impl = ci.implClass; if (ci.getSuperClass() == null) { JVar $loc = impl.field(JMod.PROTECTED, Locator.class, fieldName); $loc.annotate(XmlLocation.class); $loc.annotate(XmlTransient.class); impl._implements(Locatable.class); impl.method(JMod.PUBLIC, Locator.class, "sourceLocation").body()._return($loc); JMethod setter = impl.method(JMod.PUBLIC, Void.TYPE, "setSourceLocation"); JVar $newLoc = setter.param(Locator.class, "newLocator"); setter.body().assign($loc, $newLoc); } } return true; }
Example #25
Source File: ObjectFactoryGeneratorImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * return a JFieldVar that represents the QName field for the given information. * * if it doesn't exist, create a static field in the class and store a new JFieldVar. */ private JExpression getQNameInvocation(CElementInfo ei) { QName name = ei.getElementName(); if(qnameMap.containsKey(name)) { return qnameMap.get(name); } if(qnameMap.size()>1024) // stop gap measure to avoid 'code too large' error in javac. return createQName(name); // [RESULT] // private static final QName _XYZ_NAME = new QName("uri", "local"); JFieldVar qnameField = objectFactory.field( JMod.PRIVATE | JMod.STATIC | JMod.FINAL, QName.class, '_' + ei.getSqueezedName() + "_QNAME", createQName(name)); qnameMap.put(name, qnameField); return qnameField; }
Example #26
Source File: ArrayField.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected final void generateArray() { field = outline.implClass.field( JMod.PROTECTED, getCoreListType(), prop.getName(false) ); annotate(field); // generate the rest of accessors generateAccessors(); }
Example #27
Source File: AbstractListField.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void generateInternalGetter() { internalGetter = outline.implClass.method(JMod.PROTECTED,listT,"_get"+prop.getName(true)); if(!eagerInstanciation) { // if eagerly instanciated, the field can't be null fixNullRef(internalGetter.body()); } internalGetter.body()._return(field); }
Example #28
Source File: ObjectFactoryGeneratorImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public ObjectFactoryGeneratorImpl( BeanGenerator outline, Model model, JPackage targetPackage ) { this.outline = outline; this.model = model; this.codeModel = this.model.codeModel; this.classRef = codeModel.ref(Class.class); // create the ObjectFactory class skeleton objectFactory = this.outline.getClassFactory().createClass( targetPackage, "ObjectFactory", null ); objectFactory.annotate2(XmlRegistryWriter.class); // generate the default constructor // // m1 result: // public ObjectFactory() {} JMethod m1 = objectFactory.constructor(JMod.PUBLIC); m1.javadoc().append("Create a new ObjectFactory that can be used to " + "create new instances of schema derived classes " + "for package: " + targetPackage.name()); // add some class javadoc objectFactory.javadoc().append( "This object contains factory methods for each \n" + "Java content interface and Java element interface \n" + "generated in the " + targetPackage.name() + " package. \n" + "<p>An ObjectFactory allows you to programatically \n" + "construct new instances of the Java representation \n" + "for XML content. The Java representation of XML \n" + "content can consist of schema derived interfaces \n" + "and classes representing the binding of schema \n" + "type definitions, element declarations and model \n" + "groups. Factory methods for each of these are \n" + "provided in this class." ); }
Example #29
Source File: ObjectFactoryGeneratorImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
public ObjectFactoryGeneratorImpl( BeanGenerator outline, Model model, JPackage targetPackage ) { this.outline = outline; this.model = model; this.codeModel = this.model.codeModel; this.classRef = codeModel.ref(Class.class); // create the ObjectFactory class skeleton objectFactory = this.outline.getClassFactory().createClass( targetPackage, "ObjectFactory", null ); objectFactory.annotate2(XmlRegistryWriter.class); // generate the default constructor // // m1 result: // public ObjectFactory() {} JMethod m1 = objectFactory.constructor(JMod.PUBLIC); m1.javadoc().append("Create a new ObjectFactory that can be used to " + "create new instances of schema derived classes " + "for package: " + targetPackage.name()); // add some class javadoc objectFactory.javadoc().append( "This object contains factory methods for each \n" + "Java content interface and Java element interface \n" + "generated in the " + targetPackage.name() + " package. \n" + "<p>An ObjectFactory allows you to programatically \n" + "construct new instances of the Java representation \n" + "for XML content. The Java representation of XML \n" + "content can consist of schema derived interfaces \n" + "and classes representing the binding of schema \n" + "type definitions, element declarations and model \n" + "groups. Factory methods for each of these are \n" + "provided in this class." ); }
Example #30
Source File: AbstractListField.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected final void generate() { // for the collectionType customization to take effect, the field needs to be strongly typed, // not just List<Foo>. field = outline.implClass.field( JMod.PROTECTED, listT, prop.getName(false) ); if(eagerInstanciation) field.init(newCoreList()); annotate(field); // generate the rest of accessors generateAccessors(); }