Package com.envoisolutions.sxc.jaxb.model

Examples of com.envoisolutions.sxc.jaxb.model.Bean


            toSet = block.decl(context.toJClass(targetType), propertyName, JExpr._null());
        } else if (targetType.equals(Object.class) || targetType.equals(Element.class)) {
            toSet = block.decl(context.toJClass(Element.class), propertyName, xsrVar.invoke("getElementAsDomElement"));
        } else {
            // Complex type which will already have an element builder defined
            Bean targetBean = model.getBean(targetType);
            JAXBObjectBuilder elementBuilder = builders.get(targetBean);
            if (elementBuilder == null) {
                toSet = block.decl(context.toJClass(targetType), propertyName, builder.getReadContextVar().invoke("unexpectedXsiType").arg(builder.getXSR()).arg(JExpr.dotclass(context.toJClass(targetType))));
            } else {
                // invoke the reader method
View Full Code Here


            elementWriteBlock = nilCond._then();
            nilCond._else().add(builder.getXSW().invoke("writeXsiNil"));
        }

        // write element
        Bean targetBean = model.getBean(type);
        if (targetBean == null || targetBean.getType().isEnum()) {
            // simple built in types like String
            writeSimpleTypeElement(builder, itemVar, type, elementWriteBlock);
        } else {
            if (!mapping.getComponentType().equals(type)) {
                QName typeName = targetBean.getSchemaTypeName();
                elementWriteBlock.add(builder.getXSW().invoke("writeXsiType").arg(typeName.getNamespaceURI()).arg(typeName.getLocalPart()));
            }

            writeClassWriter(builder, targetBean, elementWriteBlock, itemVar);
        }
View Full Code Here

                  .arg(propertyVar));
    }

    private Property findReferencedIdProperty(Property property) {
        // find referenced bean
        Bean targetBean = model.getBean(toClass(property.getComponentType()));
        if (targetBean == null) {
            throw new BuildException("Unknown bean " + toClass(property.getType()));
        }

        // find id property on referenced bean
        Property idProperty = null;
        while (idProperty == null) {
            for (Property targetProperty : targetBean.getProperties()) {
                if (targetProperty.isId()) {
                    idProperty = targetProperty;
                    break;
                }
            }
            if (idProperty == null) {
                if (targetBean.getBaseClass() == null) {
                    throw new BuildException("Property " + property + " is an IDREF, but property type " + toClass(property.getType()).getName() + " does not have an ID property");
                }
                targetBean = targetBean.getBaseClass();
            }
        }
        return idProperty;
    }
View Full Code Here

TOP

Related Classes of com.envoisolutions.sxc.jaxb.model.Bean

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.