Package org.modeshape.jcr.value

Examples of org.modeshape.jcr.value.ValueFormatException


        return create(getDecoder(decoder).decode(value));
    }

    @Override
    public Reference create( int value ) {
        throw new ValueFormatException(value, getPropertyType(),
                                       GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
                                                                          Integer.class.getSimpleName(),
                                                                          value));
    }
View Full Code Here


                                                                          value));
    }

    @Override
    public Reference create( long value ) {
        throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
                                                                                                    Long.class.getSimpleName(),
                                                                                                    value));
    }
View Full Code Here

                                                                                                    value));
    }

    @Override
    public Reference create( boolean value ) {
        throw new ValueFormatException(value, getPropertyType(),
                                       GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
                                                                          Boolean.class.getSimpleName(),
                                                                          value));
    }
View Full Code Here

            assert segment.isIdentifier();
            try {
                // The local part of the segment's name should be the identifier ...
                return segment.getString(getEncoder());
            } catch (IllegalArgumentException err) {
                throw new ValueFormatException(value, PropertyType.STRING,
                                               GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
                                                                                  Path.class.getSimpleName(),
                                                                                  value));
            }
        }
View Full Code Here

        if (value.isIdentifier()) {
            try {
                // The local part of the segment's name should be the identifier, though it may not be a UUID ...
                return value.getName().getLocalName();
            } catch (IllegalArgumentException err) {
                throw new ValueFormatException(value, PropertyType.STRING,
                                               GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
                                                                                  Path.Segment.class.getSimpleName(),
                                                                                  value));
            }
        }
View Full Code Here

    public String create( byte[] value ) {
        if (value == null) return null;
        try {
            return new String(value, "UTF-8");
        } catch (UnsupportedEncodingException err) {
            throw new ValueFormatException(value, getPropertyType(),
                                           GraphI18n.errorConvertingType.text(byte[].class.getSimpleName(),
                                                                              String.class.getSimpleName(),
                                                                              value), err);
        }
    }
View Full Code Here

        byte[] value = null;
        try {
            value = IoUtil.readBytes(stream);
            return new String(value, "UTF-8");
        } catch (UnsupportedEncodingException err) {
            throw new ValueFormatException(value, getPropertyType(),
                                           GraphI18n.errorConvertingType.text(InputStream.class.getSimpleName(),
                                                                              String.class.getSimpleName(),
                                                                              value), err);
        } catch (IOException err) {
            throw new IoException(GraphI18n.errorConvertingIo.text(InputStream.class.getSimpleName(),
View Full Code Here

            for (int i = 0; i < valueConstraints.length; i++) {
                String expr = valueConstraints[i];
                try {
                    constraints[i] = Pattern.compile(expr);
                } catch (Exception e) {
                    throw new ValueFormatException(expr, org.modeshape.jcr.value.PropertyType.STRING, "Invalid string pattern ");
                }
                expressions.add(expr);
            }
        }
View Full Code Here

    public Double create( String value ) {
        if (value == null) return null;
        try {
            return Double.valueOf(value.trim());
        } catch (NumberFormatException err) {
            throw new ValueFormatException(value, getPropertyType(),
                                           GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
                                                                              Double.class.getSimpleName(),
                                                                              value), err);
        }
    }
View Full Code Here

        return new Double(value);
    }

    @Override
    public Double create( boolean value ) {
        throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
                                                                                                    Double.class.getSimpleName(),
                                                                                                    value));
    }
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.value.ValueFormatException

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.