Package org.geotools.xml

Examples of org.geotools.xml.ComplexBinding


                return;
            }
        }

        if (binding instanceof ComplexBinding) {
            ComplexBinding complex = (ComplexBinding) binding;

            try {
                Element element = complex.encode(object, document, encoding);

                if (element != null) {
                    encoding = element;
                }
            } catch (Throwable t) {
View Full Code Here


        if (child != null) {
            return;
        }

        if (binding instanceof ComplexBinding) {
            ComplexBinding complex = (ComplexBinding) binding;

            if (binding.getType() == null) {
                LOGGER.warning("Binding for: " + binding.getTarget() + " does not declare type");
            }

            Object parent = this.parent;

            if (parent != null && (binding.getType() != null)
                    && !binding.getType().isAssignableFrom(parent.getClass())) {
                LOGGER.fine(parent + " (" + parent.getClass().getName() + ") "
                    + " is not of type " + binding.getType().getName());

                //try to convert
                Object converted = Converters.convert(parent, binding.getType());

                if (converted != null) {
                    parent = converted;
                } else {
                    LOGGER.fine("Could not convert " + parent + " to "
                        + binding.getType().getName());
                    // For complex feature, if the feature can't be converted to the binding type,
                    // exit the route to avoid ClassCastException raised in
                    // child = complex.getProperty(parent, name);
                    // For example, MeasureTypeBinding.getProperty(parent, name) throws
                    // ClassCastException when 'uom' is not set.
                    if (parent instanceof ComplexAttributeImpl) {
                        return;
                    }
                }
            }

            try {
                child = complex.getProperty(parent, name);
            } catch (Exception e) {
                throw new RuntimeException("Failed to get property: " + name, e);
            }
        }
    }
View Full Code Here

        return properties;
    }

    public void visit(Binding binding) {
        if (binding instanceof ComplexBinding) {
            ComplexBinding complex = (ComplexBinding) binding;

            try {
                List properties = complex.getProperties(parent);
                if ( properties == null || properties.isEmpty() ) {
                    properties = complex.getProperties(parent, element);
                }
                if (properties != null) {
                    this.properties.addAll(properties);
                }
            } catch (Exception e) {
                String msg = "Failed to get properties. Binding for " + complex.getTarget();
                throw new RuntimeException(msg, e);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.geotools.xml.ComplexBinding

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.