Package com.cloudhopper.commons.xbean

Examples of com.cloudhopper.commons.xbean.ConversionException


        }
    }
   
    static public String normalizeLeadingHexZeroes(String v, int length) throws ConversionException {
        if (v == null || v.length() == 0) {
            throw new ConversionException("Empty or null value detected; unable to convert");
        } else if (v.length() == length) {
            return v;
        } else if (v.length() < length) {
            // add leading zeroes
            int prepend = (length - v.length());
View Full Code Here


        if (value.equalsIgnoreCase("true")) {
            return true;
        } else if (value.equalsIgnoreCase("false")) {
            return false;
        } else {
            throw new ConversionException("A boolean value must either be 'true' or 'false' [actual='" + value + "']");
        }
    }
View Full Code Here

    @Override
    public Object convert(String value) throws ConversionException {
        try {
            return Double.parseDouble(value);
        } catch (NumberFormatException e) {
            throw new ConversionException(e.getMessage());
        }
    }
View Full Code Here

                } else {
                    return Long.parseLong(result.getNumber());
                }
            }
        } catch (NumberFormatException e) {
            throw new ConversionException(e.getMessage());
        }
    }
View Full Code Here

                return ByteArrayUtil.toInt(bytes);
            } else {
                return Integer.parseInt(result.getNumber());
            }
        } catch (NumberFormatException e) {
            throw new ConversionException(e.getMessage());
        }
    }
View Full Code Here

    @Override
    public Object convert(String value) throws ConversionException {
        try {
            return new URL(value);
        } catch (MalformedURLException e) {
            throw new ConversionException(e.getMessage());
        }
    }
View Full Code Here

    @Override
    public Object convert(String value) throws ConversionException {
        try {
            return Float.parseFloat(value);
        } catch (NumberFormatException e) {
            throw new ConversionException(e.getMessage());
        }
    }
View Full Code Here

        if (value.equalsIgnoreCase("true")) {
            return Boolean.TRUE;
        } else if (value.equalsIgnoreCase("false")) {
            return Boolean.FALSE;
        } else {
            throw new ConversionException("A boolean value must either be 'true' or 'false' [actual='" + value + "']");
        }
    }
View Full Code Here

                return ByteArrayUtil.toByte(bytes);
            } else {
                return Byte.parseByte(result.getNumber());
            }
        } catch (NumberFormatException e) {
            throw new ConversionException(e.getMessage());
        }
    }
View Full Code Here

                return ByteArrayUtil.toShort(bytes);
            } else {
                return Short.parseShort(result.getNumber());
            }
        } catch (NumberFormatException e) {
            throw new ConversionException(e.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of com.cloudhopper.commons.xbean.ConversionException

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.