Package org.jdesktop.binding.metadata

Examples of org.jdesktop.binding.metadata.Converter


            return convertedValue;
        }
        Class elementClass = metaData.getElementClass();
        if (componentValue instanceof String) {
            String stringValue = (String) componentValue;
            Converter converter = metaData.getConverter();
            if (converter != null) {
                convertedValue = converter.decode(stringValue,
                                                      metaData.getDecodeFormat());
            } else if (metaData.getElementClass() == String.class) {
                convertedValue = componentValue;
            }
        }
View Full Code Here


    }

    protected String convertFromModelType(Object modelValue) {
        if (modelValue != null) {
            try {
                Converter converter = metaData.getConverter();
                return converter.encode(modelValue, metaData.getEncodeFormat());
            }
            catch (Exception e) {
                /**@todo aim: how to handle conversion failure? */
                return modelValue.toString();
            }
View Full Code Here

                        if (type.length() > 0) {
                            Class klass = decodeType(type);
                            if (klass != null) {
                                setColumnClass(k, klass);
                                if (klass != String.class) {
                                    Converter converter =
                                        Converters.get(klass);
                                    if (converter == null) {
                                        System.err.println(
                                            "warning: couldn't find converter for " +
                                            klass.getName() +
View Full Code Here

                        //    System.out.println("Value of " + node + " at column " +
                        //                       column + "=" + elem + ";" + elem.getFirstChild());
                        Node cellData = elem.getFirstChild();
                        String  rawValue = cellData == null ?
                              "" : cellData.getNodeValue();
                        Converter converter =
                            getMetaData().getColumnConverter(column + 1);
                        if (converter == null) {
                            return rawValue;
                        }
                        else {
                            try {
                                /** @todo cache converted value */
                                return converter.decode(rawValue, null);
                            }
                            catch (Exception ex) {
                                return rawValue;
                            }
                        }
View Full Code Here

TOP

Related Classes of org.jdesktop.binding.metadata.Converter

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.