modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.java [57:82]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public OMElement transform(Object source, TransformationContext context) {
        try {
            JSONObject json = JSONHelper.toJettison(source);
            if (json == null) {
                return null;
            }
            String ns = JSONDataBinding.ROOT_ELEMENT.getNamespaceURI();
            String name = JSONDataBinding.ROOT_ELEMENT.getLocalPart();
            if (context != null) {
                DataType<?> dataType = context.getTargetDataType();
                Object logical = dataType.getLogical();
                if (logical instanceof XMLType) {
                    XMLType xmlType = (XMLType)logical;
                    if (xmlType.isElement()) {
                        ns = xmlType.getElementName().getNamespaceURI();
                        name = xmlType.getElementName().getLocalPart();
                    }
                }
            }
            JSONBadgerfishDataSource ds = new JSONBadgerfishDataSource(json);
            OMNamespace namespace = factory.createOMNamespace(ns, "");
            return factory.createOMElement(ds, name, namespace);
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



modules/databinding-json-2-x/src/main/java/org/apache/tuscany/sca/databinding/json2x/axiom/JSON2OMElement.java [57:82]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public OMElement transform(Object source, TransformationContext context) {
        try {
            JSONObject json = JSONHelper.toJettison(source);
            if (json == null) {
                return null;
            }
            String ns = JSONDataBinding.ROOT_ELEMENT.getNamespaceURI();
            String name = JSONDataBinding.ROOT_ELEMENT.getLocalPart();
            if (context != null) {
                DataType<?> dataType = context.getTargetDataType();
                Object logical = dataType.getLogical();
                if (logical instanceof XMLType) {
                    XMLType xmlType = (XMLType)logical;
                    if (xmlType.isElement()) {
                        ns = xmlType.getElementName().getNamespaceURI();
                        name = xmlType.getElementName().getLocalPart();
                    }
                }
            }
            JSONBadgerfishDataSource ds = new JSONBadgerfishDataSource(json);
            OMNamespace namespace = factory.createOMNamespace(ns, "");
            return factory.createOMElement(ds, name, namespace);
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



