Package javax.xml.bind.annotation

Examples of javax.xml.bind.annotation.XmlAttribute


            } else {
                LOG.warning("Schema associated with " + namespace + " is null");
            }
            for (Field f : ReflectionUtil.getDeclaredFields(cls)) {
                if (JAXBContextInitializer.isFieldAccepted(f, accessType)) {
                    XmlAttribute at = f.getAnnotation(XmlAttribute.class);
                    if (at == null) {
                        QName fname = new QName(namespace, f.getName());
                        ReflectionUtil.setAccessible(f);
                        if (JAXBSchemaInitializer.isArray(f.getGenericType())) {
                            writeArrayObject(marshaller, writer, fname, f.get(elValue));
View Full Code Here


            for( Field field : jaxbCmdClass.getDeclaredFields() ) {
                String fullFieldName = jaxbCmdClass.getSimpleName() + "." + field.getName();
                field.setAccessible(true);
                // check that type matches
                XmlElement xmlElem = ((XmlElement) field.getAnnotation(XmlElement.class));
                XmlAttribute xmlAttribute = ((XmlAttribute) field.getAnnotation(XmlAttribute.class));
                if( xmlElem != null ) {
                    String xmlElemName = xmlElem.name();
                    if( xmlElemName != null && xmlElemName.equals(PROCESS_INSTANCE_ID_NAME) ) {
                        assertTrue( fullFieldName + " is an incorrect type! (" + field.getType() + ")",
                                field.getType().equals(Long.class) || field.getType().equals(long.class) );
                    }
                } else if (xmlAttribute != null) {
                    String xmlAttributeName = xmlAttribute.name();
                    if( xmlAttributeName != null && xmlAttributeName.equals(PROCESS_INSTANCE_ID_NAME) ) {
                        assertTrue( fullFieldName + " is an incorrect type! (" + field.getType() + ")",
                                field.getType().equals(Long.class) || field.getType().equals(long.class) );
                    }
                }
                // check that field has correct XmlElement name
                String name = field.getName().toLowerCase();
                if( name.startsWith("proc") && name.contains("inst")
                        && ! name.endsWith("s") && ! name.endsWith("list")) {
                    xmlElem = ((XmlElement) field.getAnnotation(XmlElement.class));
                    xmlAttribute = ((XmlAttribute) field.getAnnotation(XmlAttribute.class));
                    String xmlElemName = null;
                    String xmlAttrName = null;

                    if( xmlElem != null ) {
                        xmlElemName = xmlElem.name();
                    }
                    if( xmlAttribute != null ) {
                        xmlAttrName = xmlAttribute.name();
                    }
                    if( "processInstanceId".equals(field.getName()) )  {
                        continue;
                    }
                    if( xmlElemName != null ) {
View Full Code Here

        // characterizing annotations. these annotations (or lack thereof) decides
        // the kind of the property it goes to.
        // I wish I could use an array...
        XmlTransient t = null;
        XmlAnyAttribute aa = null;
        XmlAttribute a = null;
        XmlValue v = null;
        XmlElement e1 = null;
        XmlElements e2 = null;
        XmlElementRef r1 = null;
        XmlElementRefs r2 = null;
View Full Code Here

    private final boolean isRequired;

    AttributePropertyInfoImpl(ClassInfoImpl<TypeT,ClassDeclT,FieldT,MethodT> parent, PropertySeed<TypeT,ClassDeclT,FieldT,MethodT> seed ) {
        super(parent,seed);
        XmlAttribute att = seed.readAnnotation(XmlAttribute.class);
        assert att!=null;

        if(att.required())
            isRequired = true;
        else isRequired = nav().isPrimitive(getIndividualType());

        this.xmlName = calcXmlName(att);
    }
View Full Code Here

        // characterizing annotations. these annotations (or lack thereof) decides
        // the kind of the property it goes to.
        // I wish I could use an array...
        XmlTransient t = null;
        XmlAnyAttribute aa = null;
        XmlAttribute a = null;
        XmlValue v = null;
        XmlElement e1 = null;
        XmlElements e2 = null;
        XmlElementRef r1 = null;
        XmlElementRefs r2 = null;
View Full Code Here

    private final boolean isRequired;

    AttributePropertyInfoImpl(ClassInfoImpl<TypeT,ClassDeclT,FieldT,MethodT> parent, PropertySeed<TypeT,ClassDeclT,FieldT,MethodT> seed ) {
        super(parent,seed);
        XmlAttribute att = seed.readAnnotation(XmlAttribute.class);
        assert att!=null;

        if(att.required())
            isRequired = true;
        else isRequired = nav().isPrimitive(getIndividualType());

        this.xmlName = calcXmlName(att);
    }
View Full Code Here

                  throw new RuntimeException("@XmlAnyElement seen on two properties: " + property.getName() + " and " + wildcardProperty.getName());
               wildcardProperty = property;
            }

            // Is this an attribute
            XmlAttribute xmlAttribute = property.getUnderlyingAnnotation(XmlAttribute.class);
            if (xmlAttribute != null)
            {
               JBossXmlAttribute jbossXmlAttribute = property.getUnderlyingAnnotation(JBossXmlAttribute.class);
               // Determine the name
               QName qName = generateXmlName(property.getName(), attributeForm, xmlAttribute.namespace(), xmlAttribute.name());
               // Resolve the type
               TypeInfo attributeTypeInfo = property.getType();
               if (jbossXmlAttribute != null && jbossXmlAttribute.type() != Object.class)
                  attributeTypeInfo = attributeTypeInfo.getTypeInfoFactory().getTypeInfo(jbossXmlAttribute.type());
               TypeBinding attributeType = resolveTypeBinding(attributeTypeInfo);
               // Create the attribute handler
               AttributeHandler attributeHandler = new PropertyHandler(property, attributeTypeInfo);
               // Create the attributre and bind it to the type
               AttributeBinding attribute = new AttributeBinding(schemaBinding, qName, attributeType, attributeHandler);
               attribute.setRequired(xmlAttribute.required());
               typeBinding.addAttribute(attribute);
               if (trace)
                  log.trace("Bound attribute " + qName + " type=" + beanInfo.getName() + " property=" + property.getName() + " propertyType=" + attributeTypeInfo);
            }
View Full Code Here

        if(property.isMap()){
          isDefaultNamespaceAllowed = false;
        }
       
        if (helper.isAnnotationPresent(element, XmlAttribute.class)) {
            XmlAttribute xmlAttribute = (XmlAttribute) helper.getAnnotation(element, XmlAttribute.class);
            name = xmlAttribute.name();
            namespace = xmlAttribute.namespace();

            if (name.equals(XMLProcessor.DEFAULT)) {
                name = defaultName;
                try {
                    name = info.getXmlNameTransformer().transformAttributeName(name);
View Full Code Here

    private final boolean isRequired;

    AttributePropertyInfoImpl(ClassInfoImpl<TypeT,ClassDeclT,FieldT,MethodT> parent, PropertySeed<TypeT,ClassDeclT,FieldT,MethodT> seed ) {
        super(parent,seed);
        XmlAttribute att = seed.readAnnotation(XmlAttribute.class);
        assert att!=null;

        if(att.required())
            isRequired = true;
        else isRequired = nav().isPrimitive(getIndividualType());

        this.xmlName = calcXmlName(att);
    }
View Full Code Here

        // characterizing annotations. these annotations (or lack thereof) decides
        // the kind of the property it goes to.
        // I wish I could use an array...
        XmlTransient t = null;
        XmlAnyAttribute aa = null;
        XmlAttribute a = null;
        XmlValue v = null;
        XmlElement e1 = null;
        XmlElements e2 = null;
        XmlElementRef r1 = null;
        XmlElementRefs r2 = null;
View Full Code Here

TOP

Related Classes of javax.xml.bind.annotation.XmlAttribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.