Package org.milyn.javabean

Examples of org.milyn.javabean.DataDecodeException


        if(resourceConfig != null) {
            String mappingValue = resourceConfig.getProperty(data);

            if(mappingValue == null) {
                if(strict) {
                    throw new DataDecodeException("Mapping <param> for data '" + data + "' not defined.");
                } else {
                    return data;
                }
            }
View Full Code Here


                    return ((BigDecimal) number).toBigInteger();
                }

                return new BigInteger(String.valueOf(number.intValue()));
            } catch (ParseException e) {
                throw new DataDecodeException("Failed to decode BigInteger value '" + data + "' using NumberFormat instance " + format + ".", e);
            }
        } else {
            try {
                return new BigInteger(data.trim());
            } catch(NumberFormatException e) {
                throw new DataDecodeException("Failed to decode BigInteger value '" + data + "'.", e);
            }
        }
    }
View Full Code Here

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

        if(format != null) {
            try {
                Number number = format.parse(data.trim());
                return number.doubleValue();
            } catch (ParseException e) {
                throw new DataDecodeException("Failed to decode Double value '" + data + "' using NumberFormat instance " + format + ".", e);
            }
        } else {
            try {
                return Double.parseDouble(data.trim());
            } catch(NumberFormatException e) {
                throw new DataDecodeException("Failed to decode Double value '" + data + "'.", e);
            }
        }
    }
View Full Code Here

    public Object decode(String data) throws DataDecodeException {
        try {
            return new File(data);
        } catch (Exception e) {
            throw new DataDecodeException("Unable to decode '" + data + "' as a "+ File.class.getName() + " instance.", e);
        }
    }
View Full Code Here

        }

        try {
            return Boolean.parseBoolean(data.trim());
        } catch(NumberFormatException e) {
            throw new DataDecodeException("Failed to decode Boolean value '" + data + "'.", e);
        }
    }
View Full Code Here

                    return new BigDecimal((BigInteger) number);
                }

                return new BigDecimal(number.doubleValue());
            } catch (ParseException e) {
                throw new DataDecodeException("Failed to decode BigDecimal value '" + data + "' using NumberFormat instance " + format + ".", e);
            }
        } else {
            try {
                return new BigDecimal(data.trim());
            } catch(NumberFormatException e) {
                throw new DataDecodeException("Failed to decode BigDecimal value '" + data + "'.", e);
            }
        }
    }
View Full Code Here

                    return (long) (number.doubleValue() * 100);
                } else {
                    return number.longValue();
                }
            } catch (ParseException e) {
                throw new DataDecodeException("Failed to decode Long value '" + data + "' using NumberFormat instance " + format + ".", e);
            }
        } else {
            try {
                return Long.parseLong(data.trim());
            } catch(NumberFormatException e) {
                throw new DataDecodeException("Failed to decode Long value '" + data + "'.", e);
            }
        }
    }
View Full Code Here

public class CharsetDecoder implements DataDecoder {
    public Object decode(String data) throws DataDecodeException {
        try {
            return Charset.forName(data);
        } catch(UnsupportedCharsetException e) {
            throw new DataDecodeException("Unsupported character set '" + data + "'.");
        }
    }
View Full Code Here

                    return (int) (number.doubleValue() * 100);
                } else {
                    return number.intValue();
                }
            } catch (ParseException e) {
                throw new DataDecodeException("Failed to decode Integer value '" + data + "' using NumberFormat instance " + format + ".", e);
            }
        } else {
            try {
                return Integer.parseInt(data.trim());
            } catch(NumberFormatException e) {
                throw new DataDecodeException("Failed to decode Integer value '" + data + "'.", e);
            }
        }
    }
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.