com.sun.tools.internal.xjc.generator.bean.ClassOutlineImpl Java Examples
The following examples show how to use
com.sun.tools.internal.xjc.generator.bean.ClassOutlineImpl.
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: IsSetField.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) { // add isSetXXX and unsetXXX. MethodWriter writer = outline.createMethodWriter(); JCodeModel codeModel = outline.parent().getCodeModel(); FieldAccessor acc = core.create(JExpr._this()); if( generateIsSetMethod ) { // [RESULT] boolean isSetXXX() JExpression hasSetValue = acc.hasSetValue(); if( hasSetValue==null ) { // this field renderer doesn't support the isSet/unset methods generation. // issue an error throw new UnsupportedOperationException(); } writer.declareMethod(codeModel.BOOLEAN,"isSet"+this.prop.getName(true)) .body()._return( hasSetValue ); } if( generateUnSetMethod ) { // [RESULT] void unsetXXX() acc.unsetValues( writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() ); } }
Example #2
Source File: IsSetField.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) { // add isSetXXX and unsetXXX. MethodWriter writer = outline.createMethodWriter(); JCodeModel codeModel = outline.parent().getCodeModel(); FieldAccessor acc = core.create(JExpr._this()); if( generateIsSetMethod ) { // [RESULT] boolean isSetXXX() JExpression hasSetValue = acc.hasSetValue(); if( hasSetValue==null ) { // this field renderer doesn't support the isSet/unset methods generation. // issue an error throw new UnsupportedOperationException(); } writer.declareMethod(codeModel.BOOLEAN,"isSet"+this.prop.getName(true)) .body()._return( hasSetValue ); } if( generateUnSetMethod ) { // [RESULT] void unsetXXX() acc.unsetValues( writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() ); } }
Example #3
Source File: ConstField.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
Example #4
Source File: ConstField.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
Example #5
Source File: ConstField.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
Example #6
Source File: IsSetField.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) { // add isSetXXX and unsetXXX. MethodWriter writer = outline.createMethodWriter(); JCodeModel codeModel = outline.parent().getCodeModel(); FieldAccessor acc = core.create(JExpr._this()); if( generateIsSetMethod ) { // [RESULT] boolean isSetXXX() JExpression hasSetValue = acc.hasSetValue(); if( hasSetValue==null ) { // this field renderer doesn't support the isSet/unset methods generation. // issue an error throw new UnsupportedOperationException(); } writer.declareMethod(codeModel.BOOLEAN,"isSet"+this.prop.getName(true)) .body()._return( hasSetValue ); } if( generateUnSetMethod ) { // [RESULT] void unsetXXX() acc.unsetValues( writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() ); } }
Example #7
Source File: ConstField.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) { super(outline,prop); // we only support value constraints for a single-value property. assert !prop.isCollection(); JPrimitiveType ptype = implType.boxify().getPrimitiveType(); // generate the constant JExpression defaultValue = null; if(prop.defaultValue!=null) defaultValue = prop.defaultValue.compute(outline.parent()); $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL, ptype!=null?ptype:implType, prop.getName(true), defaultValue ); $ref.javadoc().append(prop.javadoc); annotate($ref); }
Example #8
Source File: IsSetField.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) { // add isSetXXX and unsetXXX. MethodWriter writer = outline.createMethodWriter(); JCodeModel codeModel = outline.parent().getCodeModel(); FieldAccessor acc = core.create(JExpr._this()); if( generateIsSetMethod ) { // [RESULT] boolean isSetXXX() JExpression hasSetValue = acc.hasSetValue(); if( hasSetValue==null ) { // this field renderer doesn't support the isSet/unset methods generation. // issue an error throw new UnsupportedOperationException(); } writer.declareMethod(codeModel.BOOLEAN,"isSet"+this.prop.getName(true)) .body()._return( hasSetValue ); } if( generateUnSetMethod ) { // [RESULT] void unsetXXX() acc.unsetValues( writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() ); } }
Example #9
Source File: AbstractListField.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Call {@link #generate()} method right after this. */ protected AbstractListField(ClassOutlineImpl outline, CPropertyInfo prop, boolean eagerInstanciation) { super(outline,prop); this.eagerInstanciation = eagerInstanciation; if( implType instanceof JPrimitiveType ) { // primitive types don't have this tricky distinction assert implType==exposedType; primitiveType = (JPrimitiveType)implType; } else primitiveType = null; }
Example #10
Source File: UntypedListFieldRenderer.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public FieldOutline generate(ClassOutlineImpl context, CPropertyInfo prop) { if (dummy) { return new DummyListField(context, prop, coreList); } if (content) { return new ContentListField(context, prop, coreList); } return new UntypedListField(context, prop, coreList); }
Example #11
Source File: GenericFieldRenderer.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public GenericFieldRenderer( Class fieldClass ) { try { constructor = fieldClass.getDeclaredConstructor(new Class[]{ClassOutlineImpl.class,CPropertyInfo.class}); } catch (NoSuchMethodException e) { throw new NoSuchMethodError(e.getMessage()); } }
Example #12
Source File: UntypedListFieldRenderer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public FieldOutline generate(ClassOutlineImpl context, CPropertyInfo prop) { if (dummy) { return new DummyListField(context, prop, coreList); } if (content) { return new ContentListField(context, prop, coreList); } return new UntypedListField(context, prop, coreList); }
Example #13
Source File: UntypedListFieldRenderer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public FieldOutline generate(ClassOutlineImpl context, CPropertyInfo prop) { if (dummy) { return new DummyListField(context, prop, coreList); } if (content) { return new ContentListField(context, prop, coreList); } return new UntypedListField(context, prop, coreList); }
Example #14
Source File: DefaultFieldRenderer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private FieldRenderer decideRenderer(ClassOutlineImpl outline, CPropertyInfo prop) { if (prop instanceof CReferencePropertyInfo) { CReferencePropertyInfo p = (CReferencePropertyInfo)prop; if (p.isDummy()) { return frf.getDummyList(outline.parent().getCodeModel().ref(ArrayList.class)); } if (p.isContent() && (p.isMixedExtendedCust())) { return frf.getContentList(outline.parent().getCodeModel().ref(ArrayList.class).narrow(Serializable.class)); } } if(!prop.isCollection()) { // non-collection field // TODO: check for bidning info for optionalPrimitiveType=boxed or // noHasMethod=false and noDeletedMethod=false if(prop.isUnboxable()) // this one uses a primitive type as much as possible return frf.getRequiredUnboxed(); else // otherwise use the default non-collection field return frf.getSingle(); } if( defaultCollectionFieldRenderer==null ) { return frf.getList(outline.parent().getCodeModel().ref(ArrayList.class)); } // this field is a collection field. // use untyped list as the default. This is consistent // to the JAXB spec. return defaultCollectionFieldRenderer; }
Example #15
Source File: AbstractField.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
protected AbstractField( ClassOutlineImpl outline, CPropertyInfo prop ) { this.outline = outline; this.prop = prop; this.codeModel = outline.parent().getCodeModel(); this.implType = getType(IMPLEMENTATION); this.exposedType = getType(Aspect.EXPOSED); }
Example #16
Source File: IsSetField.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected IsSetField( ClassOutlineImpl outline, CPropertyInfo prop, FieldOutline core, boolean unsetMethod, boolean issetMethod ) { super(outline,prop); this.core = core; this.generateIsSetMethod = issetMethod; this.generateUnSetMethod = unsetMethod; generate(outline,prop); }
Example #17
Source File: AbstractField.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
protected AbstractField( ClassOutlineImpl outline, CPropertyInfo prop ) { this.outline = outline; this.prop = prop; this.codeModel = outline.parent().getCodeModel(); this.implType = getType(IMPLEMENTATION); this.exposedType = getType(Aspect.EXPOSED); }
Example #18
Source File: IsSetField.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected IsSetField( ClassOutlineImpl outline, CPropertyInfo prop, FieldOutline core, boolean unsetMethod, boolean issetMethod ) { super(outline,prop); this.core = core; this.generateIsSetMethod = issetMethod; this.generateUnSetMethod = unsetMethod; generate(outline,prop); }
Example #19
Source File: IsSetField.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
protected IsSetField( ClassOutlineImpl outline, CPropertyInfo prop, FieldOutline core, boolean unsetMethod, boolean issetMethod ) { super(outline,prop); this.core = core; this.generateIsSetMethod = issetMethod; this.generateUnSetMethod = unsetMethod; generate(outline,prop); }
Example #20
Source File: AbstractListField.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Call {@link #generate()} method right after this. */ protected AbstractListField(ClassOutlineImpl outline, CPropertyInfo prop, boolean eagerInstanciation) { super(outline,prop); this.eagerInstanciation = eagerInstanciation; if( implType instanceof JPrimitiveType ) { // primitive types don't have this tricky distinction assert implType==exposedType; primitiveType = (JPrimitiveType)implType; } else primitiveType = null; }
Example #21
Source File: DummyListField.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * @param coreList * A concrete class that implements the List interface. * An instance of this class will be used to store data * for this field. */ protected DummyListField(ClassOutlineImpl context, CPropertyInfo prop, JClass coreList) { // the JAXB runtime picks ArrayList if the signature is List, // so don't do eager allocation if it's ArrayList. // otherwise we need to do eager allocation so that the collection type specified by the user // will be used. super(context, prop, !coreList.fullName().equals("java.util.ArrayList")); this.coreList = coreList.narrow(exposedType.boxify()); generate(); }
Example #22
Source File: DefaultFieldRenderer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private FieldRenderer decideRenderer(ClassOutlineImpl outline, CPropertyInfo prop) { if (prop instanceof CReferencePropertyInfo) { CReferencePropertyInfo p = (CReferencePropertyInfo)prop; if (p.isDummy()) { return frf.getDummyList(outline.parent().getCodeModel().ref(ArrayList.class)); } if (p.isContent() && (p.isMixedExtendedCust())) { return frf.getContentList(outline.parent().getCodeModel().ref(ArrayList.class).narrow(Serializable.class)); } } if(!prop.isCollection()) { // non-collection field // TODO: check for bidning info for optionalPrimitiveType=boxed or // noHasMethod=false and noDeletedMethod=false if(prop.isUnboxable()) // this one uses a primitive type as much as possible return frf.getRequiredUnboxed(); else // otherwise use the default non-collection field return frf.getSingle(); } if( defaultCollectionFieldRenderer==null ) { return frf.getList(outline.parent().getCodeModel().ref(ArrayList.class)); } // this field is a collection field. // use untyped list as the default. This is consistent // to the JAXB spec. return defaultCollectionFieldRenderer; }
Example #23
Source File: ContentListField.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * @param coreList * A concrete class that implements the List interface. * An instance of this class will be used to store data * for this field. */ protected ContentListField(ClassOutlineImpl context, CPropertyInfo prop, JClass coreList) { // the JAXB runtime picks ArrayList if the signature is List, // so don't do eager allocation if it's ArrayList. // otherwise we need to do eager allocation so that the collection type specified by the user // will be used. super(context, prop, false); this.coreList = coreList; generate(); }
Example #24
Source File: GenericFieldRenderer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public GenericFieldRenderer( Class fieldClass ) { try { constructor = fieldClass.getDeclaredConstructor(new Class[]{ClassOutlineImpl.class,CPropertyInfo.class}); } catch (NoSuchMethodException e) { throw new NoSuchMethodError(e.getMessage()); } }
Example #25
Source File: AbstractField.java From hottub with GNU General Public License v2.0 | 5 votes |
protected AbstractField( ClassOutlineImpl outline, CPropertyInfo prop ) { this.outline = outline; this.prop = prop; this.codeModel = outline.parent().getCodeModel(); this.implType = getType(IMPLEMENTATION); this.exposedType = getType(Aspect.EXPOSED); }
Example #26
Source File: GenericFieldRenderer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public GenericFieldRenderer( Class fieldClass ) { try { constructor = fieldClass.getDeclaredConstructor(new Class[]{ClassOutlineImpl.class,CPropertyInfo.class}); } catch (NoSuchMethodException e) { throw new NoSuchMethodError(e.getMessage()); } }
Example #27
Source File: ContentListField.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * @param coreList * A concrete class that implements the List interface. * An instance of this class will be used to store data * for this field. */ protected ContentListField(ClassOutlineImpl context, CPropertyInfo prop, JClass coreList) { // the JAXB runtime picks ArrayList if the signature is List, // so don't do eager allocation if it's ArrayList. // otherwise we need to do eager allocation so that the collection type specified by the user // will be used. super(context, prop, false); this.coreList = coreList; generate(); }
Example #28
Source File: DefaultFieldRenderer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private FieldRenderer decideRenderer(ClassOutlineImpl outline, CPropertyInfo prop) { if (prop instanceof CReferencePropertyInfo) { CReferencePropertyInfo p = (CReferencePropertyInfo)prop; if (p.isDummy()) { return frf.getDummyList(outline.parent().getCodeModel().ref(ArrayList.class)); } if (p.isContent() && (p.isMixedExtendedCust())) { return frf.getContentList(outline.parent().getCodeModel().ref(ArrayList.class).narrow(Serializable.class)); } } if(!prop.isCollection()) { // non-collection field // TODO: check for bidning info for optionalPrimitiveType=boxed or // noHasMethod=false and noDeletedMethod=false if(prop.isUnboxable()) // this one uses a primitive type as much as possible return frf.getRequiredUnboxed(); else // otherwise use the default non-collection field return frf.getSingle(); } if( defaultCollectionFieldRenderer==null ) { return frf.getList(outline.parent().getCodeModel().ref(ArrayList.class)); } // this field is a collection field. // use untyped list as the default. This is consistent // to the JAXB spec. return defaultCollectionFieldRenderer; }
Example #29
Source File: DummyListField.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * @param coreList * A concrete class that implements the List interface. * An instance of this class will be used to store data * for this field. */ protected DummyListField(ClassOutlineImpl context, CPropertyInfo prop, JClass coreList) { // the JAXB runtime picks ArrayList if the signature is List, // so don't do eager allocation if it's ArrayList. // otherwise we need to do eager allocation so that the collection type specified by the user // will be used. super(context, prop, !coreList.fullName().equals("java.util.ArrayList")); this.coreList = coreList.narrow(exposedType.boxify()); generate(); }
Example #30
Source File: IsSetField.java From hottub with GNU General Public License v2.0 | 5 votes |
protected IsSetField( ClassOutlineImpl outline, CPropertyInfo prop, FieldOutline core, boolean unsetMethod, boolean issetMethod ) { super(outline,prop); this.core = core; this.generateIsSetMethod = issetMethod; this.generateUnSetMethod = unsetMethod; generate(outline,prop); }