Java Code Examples for com.sun.tools.internal.xjc.model.CElementInfo#hasClass()

The following examples show how to use com.sun.tools.internal.xjc.model.CElementInfo#hasClass() . 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: BeanGenerator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public ElementOutlineImpl getElement(CElementInfo ei) {
    ElementOutlineImpl def = elements.get(ei);
    if (def == null && ei.hasClass()) {
        // create one. in the constructor it adds itself to the elements.
        def = new ElementOutlineImpl(this, ei);
    }
    return def;
}
 
Example 2
Source File: ElementOutlineImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
ElementOutlineImpl(BeanGenerator parent, CElementInfo ei) {
    super(ei,
          parent.getClassFactory().createClass(
                  parent.getContainer( ei.parent, Aspect.EXPOSED ), ei.shortName(), ei.getLocator() ));
    this.parent = parent;
    parent.elements.put(ei,this);

    JCodeModel cm = parent.getCodeModel();

    implClass._extends(
        cm.ref(JAXBElement.class).narrow(
            target.getContentInMemoryType().toType(parent,Aspect.EXPOSED).boxify()));

    if(ei.hasClass()) {
        JType implType = ei.getContentInMemoryType().toType(parent,Aspect.IMPLEMENTATION);
        JExpression declaredType = JExpr.cast(cm.ref(Class.class),implType.boxify().dotclass()); // why do we have to cast?
        JClass scope=null;
        if(ei.getScope()!=null)
            scope = parent.getClazz(ei.getScope()).implRef;
        JExpression scopeClass = scope==null?JExpr._null():scope.dotclass();
        JFieldVar valField = implClass.field(JMod.PROTECTED|JMod.FINAL|JMod.STATIC,QName.class,"NAME",createQName(cm,ei.getElementName()));

        // take this opportunity to generate a constructor in the element class
        JMethod cons = implClass.constructor(JMod.PUBLIC);
        cons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(cons.param(implType,"value"));

        // generate no-arg constructor in the element class (bug #391; section 5.6.2 in JAXB spec 2.1)
        JMethod noArgCons = implClass.constructor(JMod.PUBLIC);
        noArgCons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(JExpr._null());

    }
}
 
Example 3
Source File: BeanGenerator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public ElementOutlineImpl getElement(CElementInfo ei) {
    ElementOutlineImpl def = elements.get(ei);
    if (def == null && ei.hasClass()) {
        // create one. in the constructor it adds itself to the elements.
        def = new ElementOutlineImpl(this, ei);
    }
    return def;
}
 
Example 4
Source File: ElementOutlineImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
ElementOutlineImpl(BeanGenerator parent, CElementInfo ei) {
    super(ei,
          parent.getClassFactory().createClass(
                  parent.getContainer( ei.parent, Aspect.EXPOSED ), ei.shortName(), ei.getLocator() ));
    this.parent = parent;
    parent.elements.put(ei,this);

    JCodeModel cm = parent.getCodeModel();

    implClass._extends(
        cm.ref(JAXBElement.class).narrow(
            target.getContentInMemoryType().toType(parent,Aspect.EXPOSED).boxify()));

    if(ei.hasClass()) {
        JType implType = ei.getContentInMemoryType().toType(parent,Aspect.IMPLEMENTATION);
        JExpression declaredType = JExpr.cast(cm.ref(Class.class),implType.boxify().dotclass()); // why do we have to cast?
        JClass scope=null;
        if(ei.getScope()!=null)
            scope = parent.getClazz(ei.getScope()).implRef;
        JExpression scopeClass = scope==null?JExpr._null():scope.dotclass();
        JFieldVar valField = implClass.field(JMod.PROTECTED|JMod.FINAL|JMod.STATIC,QName.class,"NAME",createQName(cm,ei.getElementName()));

        // take this opportunity to generate a constructor in the element class
        JMethod cons = implClass.constructor(JMod.PUBLIC);
        cons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(cons.param(implType,"value"));

        // generate no-arg constructor in the element class (bug #391; section 5.6.2 in JAXB spec 2.1)
        JMethod noArgCons = implClass.constructor(JMod.PUBLIC);
        noArgCons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(JExpr._null());

    }
}
 
Example 5
Source File: BeanGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public ElementOutlineImpl getElement(CElementInfo ei) {
    ElementOutlineImpl def = elements.get(ei);
    if (def == null && ei.hasClass()) {
        // create one. in the constructor it adds itself to the elements.
        def = new ElementOutlineImpl(this, ei);
    }
    return def;
}
 
Example 6
Source File: ElementOutlineImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
ElementOutlineImpl(BeanGenerator parent, CElementInfo ei) {
    super(ei,
          parent.getClassFactory().createClass(
                  parent.getContainer( ei.parent, Aspect.EXPOSED ), ei.shortName(), ei.getLocator() ));
    this.parent = parent;
    parent.elements.put(ei,this);

    JCodeModel cm = parent.getCodeModel();

    implClass._extends(
        cm.ref(JAXBElement.class).narrow(
            target.getContentInMemoryType().toType(parent,Aspect.EXPOSED).boxify()));

    if(ei.hasClass()) {
        JType implType = ei.getContentInMemoryType().toType(parent,Aspect.IMPLEMENTATION);
        JExpression declaredType = JExpr.cast(cm.ref(Class.class),implType.boxify().dotclass()); // why do we have to cast?
        JClass scope=null;
        if(ei.getScope()!=null)
            scope = parent.getClazz(ei.getScope()).implRef;
        JExpression scopeClass = scope==null?JExpr._null():scope.dotclass();
        JFieldVar valField = implClass.field(JMod.PROTECTED|JMod.FINAL|JMod.STATIC,QName.class,"NAME",createQName(cm,ei.getElementName()));

        // take this opportunity to generate a constructor in the element class
        JMethod cons = implClass.constructor(JMod.PUBLIC);
        cons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(cons.param(implType,"value"));

        // generate no-arg constructor in the element class (bug #391; section 5.6.2 in JAXB spec 2.1)
        JMethod noArgCons = implClass.constructor(JMod.PUBLIC);
        noArgCons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(JExpr._null());

    }
}
 
Example 7
Source File: BeanGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public ElementOutlineImpl getElement(CElementInfo ei) {
    ElementOutlineImpl def = elements.get(ei);
    if (def == null && ei.hasClass()) {
        // create one. in the constructor it adds itself to the elements.
        def = new ElementOutlineImpl(this, ei);
    }
    return def;
}
 
Example 8
Source File: ElementOutlineImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
ElementOutlineImpl(BeanGenerator parent, CElementInfo ei) {
    super(ei,
          parent.getClassFactory().createClass(
                  parent.getContainer( ei.parent, Aspect.EXPOSED ), ei.shortName(), ei.getLocator() ));
    this.parent = parent;
    parent.elements.put(ei,this);

    JCodeModel cm = parent.getCodeModel();

    implClass._extends(
        cm.ref(JAXBElement.class).narrow(
            target.getContentInMemoryType().toType(parent,Aspect.EXPOSED).boxify()));

    if(ei.hasClass()) {
        JType implType = ei.getContentInMemoryType().toType(parent,Aspect.IMPLEMENTATION);
        JExpression declaredType = JExpr.cast(cm.ref(Class.class),implType.boxify().dotclass()); // why do we have to cast?
        JClass scope=null;
        if(ei.getScope()!=null)
            scope = parent.getClazz(ei.getScope()).implRef;
        JExpression scopeClass = scope==null?JExpr._null():scope.dotclass();
        JFieldVar valField = implClass.field(JMod.PROTECTED|JMod.FINAL|JMod.STATIC,QName.class,"NAME",createQName(cm,ei.getElementName()));

        // take this opportunity to generate a constructor in the element class
        JMethod cons = implClass.constructor(JMod.PUBLIC);
        cons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(cons.param(implType,"value"));

        // generate no-arg constructor in the element class (bug #391; section 5.6.2 in JAXB spec 2.1)
        JMethod noArgCons = implClass.constructor(JMod.PUBLIC);
        noArgCons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(JExpr._null());

    }
}
 
Example 9
Source File: BeanGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public ElementOutlineImpl getElement(CElementInfo ei) {
    ElementOutlineImpl def = elements.get(ei);
    if (def == null && ei.hasClass()) {
        // create one. in the constructor it adds itself to the elements.
        def = new ElementOutlineImpl(this, ei);
    }
    return def;
}
 
Example 10
Source File: ElementOutlineImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
ElementOutlineImpl(BeanGenerator parent, CElementInfo ei) {
    super(ei,
          parent.getClassFactory().createClass(
                  parent.getContainer( ei.parent, Aspect.EXPOSED ), ei.shortName(), ei.getLocator() ));
    this.parent = parent;
    parent.elements.put(ei,this);

    JCodeModel cm = parent.getCodeModel();

    implClass._extends(
        cm.ref(JAXBElement.class).narrow(
            target.getContentInMemoryType().toType(parent,Aspect.EXPOSED).boxify()));

    if(ei.hasClass()) {
        JType implType = ei.getContentInMemoryType().toType(parent,Aspect.IMPLEMENTATION);
        JExpression declaredType = JExpr.cast(cm.ref(Class.class),implType.boxify().dotclass()); // why do we have to cast?
        JClass scope=null;
        if(ei.getScope()!=null)
            scope = parent.getClazz(ei.getScope()).implRef;
        JExpression scopeClass = scope==null?JExpr._null():scope.dotclass();
        JFieldVar valField = implClass.field(JMod.PROTECTED|JMod.FINAL|JMod.STATIC,QName.class,"NAME",createQName(cm,ei.getElementName()));

        // take this opportunity to generate a constructor in the element class
        JMethod cons = implClass.constructor(JMod.PUBLIC);
        cons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(cons.param(implType,"value"));

        // generate no-arg constructor in the element class (bug #391; section 5.6.2 in JAXB spec 2.1)
        JMethod noArgCons = implClass.constructor(JMod.PUBLIC);
        noArgCons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(JExpr._null());

    }
}
 
Example 11
Source File: BeanGenerator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public ElementOutlineImpl getElement(CElementInfo ei) {
    ElementOutlineImpl def = elements.get(ei);
    if (def == null && ei.hasClass()) {
        // create one. in the constructor it adds itself to the elements.
        def = new ElementOutlineImpl(this, ei);
    }
    return def;
}
 
Example 12
Source File: ElementOutlineImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
ElementOutlineImpl(BeanGenerator parent, CElementInfo ei) {
    super(ei,
          parent.getClassFactory().createClass(
                  parent.getContainer( ei.parent, Aspect.EXPOSED ), ei.shortName(), ei.getLocator() ));
    this.parent = parent;
    parent.elements.put(ei,this);

    JCodeModel cm = parent.getCodeModel();

    implClass._extends(
        cm.ref(JAXBElement.class).narrow(
            target.getContentInMemoryType().toType(parent,Aspect.EXPOSED).boxify()));

    if(ei.hasClass()) {
        JType implType = ei.getContentInMemoryType().toType(parent,Aspect.IMPLEMENTATION);
        JExpression declaredType = JExpr.cast(cm.ref(Class.class),implType.boxify().dotclass()); // why do we have to cast?
        JClass scope=null;
        if(ei.getScope()!=null)
            scope = parent.getClazz(ei.getScope()).implRef;
        JExpression scopeClass = scope==null?JExpr._null():scope.dotclass();
        JFieldVar valField = implClass.field(JMod.PROTECTED|JMod.FINAL|JMod.STATIC,QName.class,"NAME",createQName(cm,ei.getElementName()));

        // take this opportunity to generate a constructor in the element class
        JMethod cons = implClass.constructor(JMod.PUBLIC);
        cons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(cons.param(implType,"value"));

        // generate no-arg constructor in the element class (bug #391; section 5.6.2 in JAXB spec 2.1)
        JMethod noArgCons = implClass.constructor(JMod.PUBLIC);
        noArgCons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(JExpr._null());

    }
}
 
Example 13
Source File: BeanGenerator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public ElementOutlineImpl getElement(CElementInfo ei) {
    ElementOutlineImpl def = elements.get(ei);
    if (def == null && ei.hasClass()) {
        // create one. in the constructor it adds itself to the elements.
        def = new ElementOutlineImpl(this, ei);
    }
    return def;
}
 
Example 14
Source File: ElementOutlineImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
ElementOutlineImpl(BeanGenerator parent, CElementInfo ei) {
    super(ei,
          parent.getClassFactory().createClass(
                  parent.getContainer( ei.parent, Aspect.EXPOSED ), ei.shortName(), ei.getLocator() ));
    this.parent = parent;
    parent.elements.put(ei,this);

    JCodeModel cm = parent.getCodeModel();

    implClass._extends(
        cm.ref(JAXBElement.class).narrow(
            target.getContentInMemoryType().toType(parent,Aspect.EXPOSED).boxify()));

    if(ei.hasClass()) {
        JType implType = ei.getContentInMemoryType().toType(parent,Aspect.IMPLEMENTATION);
        JExpression declaredType = JExpr.cast(cm.ref(Class.class),implType.boxify().dotclass()); // why do we have to cast?
        JClass scope=null;
        if(ei.getScope()!=null)
            scope = parent.getClazz(ei.getScope()).implRef;
        JExpression scopeClass = scope==null?JExpr._null():scope.dotclass();
        JFieldVar valField = implClass.field(JMod.PROTECTED|JMod.FINAL|JMod.STATIC,QName.class,"NAME",createQName(cm,ei.getElementName()));

        // take this opportunity to generate a constructor in the element class
        JMethod cons = implClass.constructor(JMod.PUBLIC);
        cons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(cons.param(implType,"value"));

        // generate no-arg constructor in the element class (bug #391; section 5.6.2 in JAXB spec 2.1)
        JMethod noArgCons = implClass.constructor(JMod.PUBLIC);
        noArgCons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(JExpr._null());

    }
}
 
Example 15
Source File: BeanGenerator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public ElementOutlineImpl getElement(CElementInfo ei) {
    ElementOutlineImpl def = elements.get(ei);
    if (def == null && ei.hasClass()) {
        // create one. in the constructor it adds itself to the elements.
        def = new ElementOutlineImpl(this, ei);
    }
    return def;
}
 
Example 16
Source File: ElementOutlineImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
ElementOutlineImpl(BeanGenerator parent, CElementInfo ei) {
    super(ei,
          parent.getClassFactory().createClass(
                  parent.getContainer( ei.parent, Aspect.EXPOSED ), ei.shortName(), ei.getLocator() ));
    this.parent = parent;
    parent.elements.put(ei,this);

    JCodeModel cm = parent.getCodeModel();

    implClass._extends(
        cm.ref(JAXBElement.class).narrow(
            target.getContentInMemoryType().toType(parent,Aspect.EXPOSED).boxify()));

    if(ei.hasClass()) {
        JType implType = ei.getContentInMemoryType().toType(parent,Aspect.IMPLEMENTATION);
        JExpression declaredType = JExpr.cast(cm.ref(Class.class),implType.boxify().dotclass()); // why do we have to cast?
        JClass scope=null;
        if(ei.getScope()!=null)
            scope = parent.getClazz(ei.getScope()).implRef;
        JExpression scopeClass = scope==null?JExpr._null():scope.dotclass();
        JFieldVar valField = implClass.field(JMod.PROTECTED|JMod.FINAL|JMod.STATIC,QName.class,"NAME",createQName(cm,ei.getElementName()));

        // take this opportunity to generate a constructor in the element class
        JMethod cons = implClass.constructor(JMod.PUBLIC);
        cons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(cons.param(implType,"value"));

        // generate no-arg constructor in the element class (bug #391; section 5.6.2 in JAXB spec 2.1)
        JMethod noArgCons = implClass.constructor(JMod.PUBLIC);
        noArgCons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(JExpr._null());

    }
}