Package org.modeshape.jcr.value

Examples of org.modeshape.jcr.value.ValueFormatException


    @Override
    public Double create( BigDecimal value ) {
        if (value == null) return null;
        double result = value.doubleValue();
        if (result == Double.NEGATIVE_INFINITY || result == Double.POSITIVE_INFINITY) {
            throw new ValueFormatException(value, getPropertyType(),
                                           GraphI18n.errorConvertingType.text(BigDecimal.class.getSimpleName(),
                                                                              Double.class.getSimpleName(),
                                                                              value));
        }
        return result;
View Full Code Here


        return create(value.getMilliseconds());
    }

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

                                                                                                    value));
    }

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

                                                                                                    value));
    }

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

                                                                          value));
    }

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

                                                                          value));
    }

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

                                                                                                    value));
    }

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

                                                                                                    value));
    }

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

                if (value.length() == 1) {
                    // This is completely blank (just a ':') ...
                    return BLANK_NAME;
                }
                // Otherwise, it's invalid with a blank prefix and non-blank local name
                throw new ValueFormatException(value, getPropertyType(),
                                               GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
                                                                                  Name.class.getSimpleName(), value));
            }
            if (firstChar == '{') {
                // This might be fully-qualified ...
                int closingBraceIndex = value.indexOf('}', 1);
                if (closingBraceIndex == 1) {
                    // It's an empty pair of braces, so treat it as the blank namespace ...
                    if (value.length() == 2) {
                        // There's nothing else ...
                        return BLANK_NAME;
                    }
                    String namespaceUri = this.namespaceRegistryHolder.getNamespaceRegistry().getNamespaceForPrefix("");
                    String localName = decoder.decode(value.substring(2));
                    return new BasicName(namespaceUri, localName);
                }
                if (closingBraceIndex > 1) {
                    // Closing brace found with chars between ...
                    String namespaceUri = value.substring(1, closingBraceIndex);
                    int nextIndexAfterClosingBrace = closingBraceIndex + 1;
                    String localName = nextIndexAfterClosingBrace < value.length() ? value.substring(nextIndexAfterClosingBrace) : "";
                    // Decode the parts ...
                    return create(namespaceUri, localName, decoder);
                }
            } else {
                // This is not fully-qualified, so see whether the value fits the prefixed name pattern ...
                int colonIndex = value.indexOf(':');
                if (colonIndex < 1) {
                    // There is no namespace prefix ...
                    String namespaceUri = this.namespaceRegistryHolder.getNamespaceRegistry().getNamespaceForPrefix("");
                    String localName = decoder.decode(value);
                    return new BasicName(namespaceUri, localName);
                }
                // There is a namespace ...
                String prefix = value.substring(0, colonIndex);
                prefix = decoder.decode(prefix);
                // Look for a namespace match ...
                String namespaceUri = this.namespaceRegistryHolder.getNamespaceRegistry().getNamespaceForPrefix(prefix);
                // Fail if no namespace is found ...
                if (namespaceUri == null) {
                    throw new NamespaceException(GraphI18n.noNamespaceRegisteredForPrefix.text(prefix));
                }
                int nextIndexAfterColon = colonIndex + 1;
                String localName = nextIndexAfterColon < value.length() ? value.substring(nextIndexAfterColon) : "";
                localName = decoder.decode(localName);
                return new BasicName(namespaceUri, localName);
            }
        } catch (NamespaceException err) {
            throw new ValueFormatException(value, getPropertyType(),
                                           GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
                                                                              Name.class.getSimpleName(), value), err);
        }
        throw new ValueFormatException(value, getPropertyType(), GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
                                                                                                    Name.class.getSimpleName(),
                                                                                                    value));
    }
View Full Code Here

        return new BasicName(namespaceUri, localName);
    }

    @Override
    public Name create( int value ) {
        throw new ValueFormatException(value, getPropertyType(),
                                       GraphI18n.unableToCreateValue.text(getPropertyType().getName(),
                                                                          Integer.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.