Java Code Examples for com.sun.xml.internal.bind.v2.runtime.property.Property

The following examples show how to use com.sun.xml.internal.bind.v2.runtime.property.Property. These examples are extracted from open source projects. 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
public void serializeBody(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
    if (superClazz != null) {
        superClazz.serializeBody(bean, target);
    }
    try {
        for (Property<BeanT> p : properties) {
            if (retainPropertyInfo) {
                target.currentProperty.set(p);
            }
            boolean isThereAnOverridingProperty = p.isHiddenByOverride();
            if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) {
                p.serializeBody(bean, target, null);
            } else if (isThereAnOverridingProperty) {
                // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only
                Class beanClass = bean.getClass();
                if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) {
                    p.serializeBody(bean, target, null);
                }
            }
        }
    } catch (AccessorException e) {
        target.reportError(null, e);
    }
}
 
Example 2
Source Project: jdk8u60   Source File: ClassBeanInfoImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void serializeBody(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
    if (superClazz != null) {
        superClazz.serializeBody(bean, target);
    }
    try {
        for (Property<BeanT> p : properties) {
            if (retainPropertyInfo) {
                target.currentProperty.set(p);
            }
            boolean isThereAnOverridingProperty = p.isHiddenByOverride();
            if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) {
                p.serializeBody(bean, target, null);
            } else if (isThereAnOverridingProperty) {
                // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only
                Class beanClass = bean.getClass();
                if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) {
                    p.serializeBody(bean, target, null);
                }
            }
        }
    } catch (AccessorException e) {
        target.reportError(null, e);
    }
}
 
Example 3
public void serializeBody(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
    if (superClazz != null) {
        superClazz.serializeBody(bean, target);
    }
    try {
        for (Property<BeanT> p : properties) {
            if (retainPropertyInfo) {
                target.currentProperty.set(p);
            }
            boolean isThereAnOverridingProperty = p.isHiddenByOverride();
            if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) {
                p.serializeBody(bean, target, null);
            } else if (isThereAnOverridingProperty) {
                // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only
                Class beanClass = bean.getClass();
                if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) {
                    p.serializeBody(bean, target, null);
                }
            }
        }
    } catch (AccessorException e) {
        target.reportError(null, e);
    }
}
 
Example 4
public void serializeBody(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
    if (superClazz != null) {
        superClazz.serializeBody(bean, target);
    }
    try {
        for (Property<BeanT> p : properties) {
            if (retainPropertyInfo) {
                target.currentProperty.set(p);
            }
            boolean isThereAnOverridingProperty = p.isHiddenByOverride();
            if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) {
                p.serializeBody(bean, target, null);
            } else if (isThereAnOverridingProperty) {
                // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only
                Class beanClass = bean.getClass();
                if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) {
                    p.serializeBody(bean, target, null);
                }
            }
        }
    } catch (AccessorException e) {
        target.reportError(null, e);
    }
}
 
Example 5
public void serializeBody(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
    if (superClazz != null) {
        superClazz.serializeBody(bean, target);
    }
    try {
        for (Property<BeanT> p : properties) {
            if (retainPropertyInfo) {
                target.currentProperty.set(p);
            }
            boolean isThereAnOverridingProperty = p.isHiddenByOverride();
            if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) {
                p.serializeBody(bean, target, null);
            } else if (isThereAnOverridingProperty) {
                // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only
                Class beanClass = bean.getClass();
                if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) {
                    p.serializeBody(bean, target, null);
                }
            }
        }
    } catch (AccessorException e) {
        target.reportError(null, e);
    }
}
 
Example 6
Source Project: hottub   Source File: ClassBeanInfoImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void serializeBody(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
    if (superClazz != null) {
        superClazz.serializeBody(bean, target);
    }
    try {
        for (Property<BeanT> p : properties) {
            if (retainPropertyInfo) {
                target.currentProperty.set(p);
            }
            boolean isThereAnOverridingProperty = p.isHiddenByOverride();
            if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) {
                p.serializeBody(bean, target, null);
            } else if (isThereAnOverridingProperty) {
                // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only
                Class beanClass = bean.getClass();
                if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) {
                    p.serializeBody(bean, target, null);
                }
            }
        }
    } catch (AccessorException e) {
        target.reportError(null, e);
    }
}
 
Example 7
public void serializeBody(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
    if (superClazz != null) {
        superClazz.serializeBody(bean, target);
    }
    try {
        for (Property<BeanT> p : properties) {
            if (retainPropertyInfo) {
                target.currentProperty.set(p);
            }
            boolean isThereAnOverridingProperty = p.isHiddenByOverride();
            if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) {
                p.serializeBody(bean, target, null);
            } else if (isThereAnOverridingProperty) {
                // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only
                Class beanClass = bean.getClass();
                if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) {
                    p.serializeBody(bean, target, null);
                }
            }
        }
    } catch (AccessorException e) {
        target.reportError(null, e);
    }
}
 
Example 8
Source Project: openjdk-8   Source File: ClassBeanInfoImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void serializeBody(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
    if (superClazz != null) {
        superClazz.serializeBody(bean, target);
    }
    try {
        for (Property<BeanT> p : properties) {
            if (retainPropertyInfo) {
                target.currentProperty.set(p);
            }
            boolean isThereAnOverridingProperty = p.isHiddenByOverride();
            if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) {
                p.serializeBody(bean, target, null);
            } else if (isThereAnOverridingProperty) {
                // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only
                Class beanClass = bean.getClass();
                if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) {
                    p.serializeBody(bean, target, null);
                }
            }
        }
    } catch (AccessorException e) {
        target.reportError(null, e);
    }
}
 
Example 9
private void checkOverrideProperties(Property p) {
    ClassBeanInfoImpl bi = this;
    while ((bi = bi.superClazz) != null) {
        Property[] props = bi.properties;
        if (props == null) break;
        for (Property superProperty : props) {
            if (superProperty != null) {
                String spName = superProperty.getFieldName();
                if ((spName != null) && (spName.equals(p.getFieldName()))) {
                    superProperty.setHiddenByOverride(true);
                }
            }
        }
    }
}
 
Example 10
@Override
public void wrapUp() {
    for (Property p : properties)
        p.wrapUp();
    ci = null;
    super.wrapUp();
}
 
Example 11
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 12
/**
 * Completes the initialization.
 *
 * <p>
 * To fix the cyclic reference issue, the main part of the initialization needs to be done
 * after a {@link StructureLoader} is set to {@link ClassBeanInfoImpl#loader}.
 */
public void init( JAXBContextImpl context, ClassBeanInfoImpl beanInfo, Accessor<?,Map<QName,String>> attWildcard) {
    UnmarshallerChain chain = new UnmarshallerChain(context);
    for (ClassBeanInfoImpl bi = beanInfo; bi != null; bi = bi.superClazz) {
        for (int i = bi.properties.length - 1; i >= 0; i--) {
            Property p = bi.properties[i];

            switch(p.getKind()) {
            case ATTRIBUTE:
                if(attUnmarshallers==null)
                    attUnmarshallers = new QNameMap<TransducedAccessor>();
                AttributeProperty ap = (AttributeProperty) p;
                attUnmarshallers.put(ap.attName.toQName(),ap.xacc);
                break;
            case ELEMENT:
            case REFERENCE:
            case MAP:
            case VALUE:
                p.buildChildElementUnmarshallers(chain,childUnmarshallers);
                break;
            }
        }
    }

    this.frameSize = chain.getScopeSize();

    textHandler = childUnmarshallers.get(StructureLoaderBuilder.TEXT_HANDLER);
    catchAll = childUnmarshallers.get(StructureLoaderBuilder.CATCH_ALL);

    if(attWildcard!=null) {
        attCatchAll = (Accessor<Object,Map<QName,String>>) attWildcard;
        // we use attUnmarshallers==null as a sign to skip the attribute processing
        // altogether, so if we have an att wildcard we need to have an empty qname map.
        if(attUnmarshallers==null)
            attUnmarshallers = EMPTY;
    } else {
        attCatchAll = null;
    }
}
 
Example 13
Source Project: jdk8u60   Source File: ClassBeanInfoImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void checkOverrideProperties(Property p) {
    ClassBeanInfoImpl bi = this;
    while ((bi = bi.superClazz) != null) {
        Property[] props = bi.properties;
        if (props == null) break;
        for (Property superProperty : props) {
            if (superProperty != null) {
                String spName = superProperty.getFieldName();
                if ((spName != null) && (spName.equals(p.getFieldName()))) {
                    superProperty.setHiddenByOverride(true);
                }
            }
        }
    }
}
 
Example 14
Source Project: jdk8u60   Source File: ClassBeanInfoImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public void wrapUp() {
    for (Property p : properties)
        p.wrapUp();
    ci = null;
    super.wrapUp();
}
 
Example 15
Source Project: jdk8u60   Source File: ClassBeanInfoImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 16
Source Project: jdk8u60   Source File: StructureLoader.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Completes the initialization.
 *
 * <p>
 * To fix the cyclic reference issue, the main part of the initialization needs to be done
 * after a {@link StructureLoader} is set to {@link ClassBeanInfoImpl#loader}.
 */
public void init( JAXBContextImpl context, ClassBeanInfoImpl beanInfo, Accessor<?,Map<QName,String>> attWildcard) {
    UnmarshallerChain chain = new UnmarshallerChain(context);
    for (ClassBeanInfoImpl bi = beanInfo; bi != null; bi = bi.superClazz) {
        for (int i = bi.properties.length - 1; i >= 0; i--) {
            Property p = bi.properties[i];

            switch(p.getKind()) {
            case ATTRIBUTE:
                if(attUnmarshallers==null)
                    attUnmarshallers = new QNameMap<TransducedAccessor>();
                AttributeProperty ap = (AttributeProperty) p;
                attUnmarshallers.put(ap.attName.toQName(),ap.xacc);
                break;
            case ELEMENT:
            case REFERENCE:
            case MAP:
            case VALUE:
                p.buildChildElementUnmarshallers(chain,childUnmarshallers);
                break;
            }
        }
    }

    this.frameSize = chain.getScopeSize();

    textHandler = childUnmarshallers.get(StructureLoaderBuilder.TEXT_HANDLER);
    catchAll = childUnmarshallers.get(StructureLoaderBuilder.CATCH_ALL);

    if(attWildcard!=null) {
        attCatchAll = (Accessor<Object,Map<QName,String>>) attWildcard;
        // we use attUnmarshallers==null as a sign to skip the attribute processing
        // altogether, so if we have an att wildcard we need to have an empty qname map.
        if(attUnmarshallers==null)
            attUnmarshallers = EMPTY;
    } else {
        attCatchAll = null;
    }
}
 
Example 17
private void checkOverrideProperties(Property p) {
    ClassBeanInfoImpl bi = this;
    while ((bi = bi.superClazz) != null) {
        Property[] props = bi.properties;
        if (props == null) break;
        for (Property superProperty : props) {
            if (superProperty != null) {
                String spName = superProperty.getFieldName();
                if ((spName != null) && (spName.equals(p.getFieldName()))) {
                    superProperty.setHiddenByOverride(true);
                }
            }
        }
    }
}
 
Example 18
@Override
public void wrapUp() {
    for (Property p : properties)
        p.wrapUp();
    ci = null;
    super.wrapUp();
}
 
Example 19
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 20
/**
 * Completes the initialization.
 *
 * <p>
 * To fix the cyclic reference issue, the main part of the initialization needs to be done
 * after a {@link StructureLoader} is set to {@link ClassBeanInfoImpl#loader}.
 */
public void init( JAXBContextImpl context, ClassBeanInfoImpl beanInfo, Accessor<?,Map<QName,String>> attWildcard) {
    UnmarshallerChain chain = new UnmarshallerChain(context);
    for (ClassBeanInfoImpl bi = beanInfo; bi != null; bi = bi.superClazz) {
        for (int i = bi.properties.length - 1; i >= 0; i--) {
            Property p = bi.properties[i];

            switch(p.getKind()) {
            case ATTRIBUTE:
                if(attUnmarshallers==null)
                    attUnmarshallers = new QNameMap<TransducedAccessor>();
                AttributeProperty ap = (AttributeProperty) p;
                attUnmarshallers.put(ap.attName.toQName(),ap.xacc);
                break;
            case ELEMENT:
            case REFERENCE:
            case MAP:
            case VALUE:
                p.buildChildElementUnmarshallers(chain,childUnmarshallers);
                break;
            }
        }
    }

    this.frameSize = chain.getScopeSize();

    textHandler = childUnmarshallers.get(StructureLoaderBuilder.TEXT_HANDLER);
    catchAll = childUnmarshallers.get(StructureLoaderBuilder.CATCH_ALL);

    if(attWildcard!=null) {
        attCatchAll = (Accessor<Object,Map<QName,String>>) attWildcard;
        // we use attUnmarshallers==null as a sign to skip the attribute processing
        // altogether, so if we have an att wildcard we need to have an empty qname map.
        if(attUnmarshallers==null)
            attUnmarshallers = EMPTY;
    } else {
        attCatchAll = null;
    }
}
 
Example 21
private void checkOverrideProperties(Property p) {
    ClassBeanInfoImpl bi = this;
    while ((bi = bi.superClazz) != null) {
        Property[] props = bi.properties;
        if (props == null) break;
        for (Property superProperty : props) {
            if (superProperty != null) {
                String spName = superProperty.getFieldName();
                if ((spName != null) && (spName.equals(p.getFieldName()))) {
                    superProperty.setHiddenByOverride(true);
                }
            }
        }
    }
}
 
Example 22
@Override
public void wrapUp() {
    for (Property p : properties)
        p.wrapUp();
    ci = null;
    super.wrapUp();
}
 
Example 23
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 24
/**
 * Completes the initialization.
 *
 * <p>
 * To fix the cyclic reference issue, the main part of the initialization needs to be done
 * after a {@link StructureLoader} is set to {@link ClassBeanInfoImpl#loader}.
 */
public void init( JAXBContextImpl context, ClassBeanInfoImpl beanInfo, Accessor<?,Map<QName,String>> attWildcard) {
    UnmarshallerChain chain = new UnmarshallerChain(context);
    for (ClassBeanInfoImpl bi = beanInfo; bi != null; bi = bi.superClazz) {
        for (int i = bi.properties.length - 1; i >= 0; i--) {
            Property p = bi.properties[i];

            switch(p.getKind()) {
            case ATTRIBUTE:
                if(attUnmarshallers==null)
                    attUnmarshallers = new QNameMap<TransducedAccessor>();
                AttributeProperty ap = (AttributeProperty) p;
                attUnmarshallers.put(ap.attName.toQName(),ap.xacc);
                break;
            case ELEMENT:
            case REFERENCE:
            case MAP:
            case VALUE:
                p.buildChildElementUnmarshallers(chain,childUnmarshallers);
                break;
            }
        }
    }

    this.frameSize = chain.getScopeSize();

    textHandler = childUnmarshallers.get(StructureLoaderBuilder.TEXT_HANDLER);
    catchAll = childUnmarshallers.get(StructureLoaderBuilder.CATCH_ALL);

    if(attWildcard!=null) {
        attCatchAll = (Accessor<Object,Map<QName,String>>) attWildcard;
        // we use attUnmarshallers==null as a sign to skip the attribute processing
        // altogether, so if we have an att wildcard we need to have an empty qname map.
        if(attUnmarshallers==null)
            attUnmarshallers = EMPTY;
    } else {
        attCatchAll = null;
    }
}
 
Example 25
private void checkOverrideProperties(Property p) {
    ClassBeanInfoImpl bi = this;
    while ((bi = bi.superClazz) != null) {
        Property[] props = bi.properties;
        if (props == null) break;
        for (Property superProperty : props) {
            if (superProperty != null) {
                String spName = superProperty.getFieldName();
                if ((spName != null) && (spName.equals(p.getFieldName()))) {
                    superProperty.setHiddenByOverride(true);
                }
            }
        }
    }
}
 
Example 26
@Override
public void wrapUp() {
    for (Property p : properties)
        p.wrapUp();
    ci = null;
    super.wrapUp();
}
 
Example 27
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 28
Source Project: openjdk-jdk9   Source File: StructureLoader.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Completes the initialization.
 *
 * <p>
 * To fix the cyclic reference issue, the main part of the initialization needs to be done
 * after a {@link StructureLoader} is set to {@link ClassBeanInfoImpl#loader}.
 */
public void init( JAXBContextImpl context, ClassBeanInfoImpl beanInfo, Accessor<?,Map<QName,String>> attWildcard) {
    UnmarshallerChain chain = new UnmarshallerChain(context);
    for (ClassBeanInfoImpl bi = beanInfo; bi != null; bi = bi.superClazz) {
        for (int i = bi.properties.length - 1; i >= 0; i--) {
            Property p = bi.properties[i];

            switch(p.getKind()) {
            case ATTRIBUTE:
                if(attUnmarshallers==null)
                    attUnmarshallers = new QNameMap<TransducedAccessor>();
                AttributeProperty ap = (AttributeProperty) p;
                attUnmarshallers.put(ap.attName.toQName(),ap.xacc);
                break;
            case ELEMENT:
            case REFERENCE:
            case MAP:
            case VALUE:
                p.buildChildElementUnmarshallers(chain,childUnmarshallers);
                break;
            }
        }
    }

    this.frameSize = chain.getScopeSize();

    textHandler = childUnmarshallers.get(StructureLoaderBuilder.TEXT_HANDLER);
    catchAll = childUnmarshallers.get(StructureLoaderBuilder.CATCH_ALL);

    if(attWildcard!=null) {
        attCatchAll = (Accessor<Object,Map<QName,String>>) attWildcard;
        // we use attUnmarshallers==null as a sign to skip the attribute processing
        // altogether, so if we have an att wildcard we need to have an empty qname map.
        if(attUnmarshallers==null)
            attUnmarshallers = EMPTY;
    } else {
        attCatchAll = null;
    }
}
 
Example 29
Source Project: hottub   Source File: ClassBeanInfoImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void checkOverrideProperties(Property p) {
    ClassBeanInfoImpl bi = this;
    while ((bi = bi.superClazz) != null) {
        Property[] props = bi.properties;
        if (props == null) break;
        for (Property superProperty : props) {
            if (superProperty != null) {
                String spName = superProperty.getFieldName();
                if ((spName != null) && (spName.equals(p.getFieldName()))) {
                    superProperty.setHiddenByOverride(true);
                }
            }
        }
    }
}
 
Example 30
Source Project: hottub   Source File: ClassBeanInfoImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public void wrapUp() {
    for (Property p : properties)
        p.wrapUp();
    ci = null;
    super.wrapUp();
}