Package org.milyn.javabean

Examples of org.milyn.javabean.DataDecodeException


            synchronized(decoder) {
                decoder.parse(data.trim());
                return decoder.getCalendar().clone();
            }
        } catch (ParseException e) {
            throw new DataDecodeException("Error decoding Date data value '" + data + "' with decode format '" + format + "'.", e);
        }
    }
View Full Code Here


        try {
            GregorianCalendar gregCal = new GregorianCalendar();
            gregCal.setTime(date);
            return DatatypeFactory.newInstance().newXMLGregorianCalendar(gregCal);
        } catch (DatatypeConfigurationException e) {
            throw new DataDecodeException("Error decoding XMLGregorianCalendar data value '" + data + "' with decode format '" + format + "'.", e);
        }
    }
View Full Code Here

    }

    @Override
    public String encode(Object date) throws DataDecodeException {
        if(!(date instanceof XMLGregorianCalendar)) {
            throw new DataDecodeException("Cannot encode Object type '" + date.getClass().getName() + "'.  Must be type '" + XMLGregorianCalendar.class.getName() + "'.");
        }
        return super.encode(((XMLGregorianCalendar)date).toGregorianCalendar().getTime());
    }
View Full Code Here

    public Object decode(String data) throws DataDecodeException {
        try {
            return Byte.parseByte(data.trim());
        } catch(NumberFormatException e) {
            throw new DataDecodeException("Failed to decode Byte value '" + data + "'.", e);
        }
    }
View Full Code Here

        String mappedValue = (String) mappingDecoder.decode(data);

        try {
            return Enum.valueOf(enumType, mappedValue.trim());
        } catch(IllegalArgumentException e) {
            throw new DataDecodeException("Failed to decode '" + mappedValue + "' as a valid Enum constant of type '" + enumType.getName() + "'.");
        }
    }
View Full Code Here

TOP

Related Classes of org.milyn.javabean.DataDecodeException

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.