protected Factory( ValueFactory<T> valueFactory ) { this.valueFactory = valueFactory; this.type = this.valueFactory.getPropertyType(); this.typeName = type.getName().toUpperCase(); }
/** * {@inheritDoc} */ public UUID create( Calendar value ) { throw new ValueFormatException(value, PropertyType.UUID, GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Calendar.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public UUID create( Date value ) { throw new ValueFormatException(value, PropertyType.UUID, GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Date.class.getSimpleName(), value)); }
/** * {@inheritDoc} * * @see org.modeshape.graph.property.ValueFactory#create(org.modeshape.graph.property.DateTime) */ public UUID create( DateTime value ) throws ValueFormatException { throw new ValueFormatException(value, PropertyType.UUID, GraphI18n.unableToCreateValue.text(getPropertyType().getName(), DateTime.class.getSimpleName(), value)); }
/** * {@inheritDoc} * * @see org.modeshape.graph.property.ValueFactory#create(java.util.UUID) */ public Long create( UUID value ) throws IoException { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), UUID.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public Name create( int value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Integer.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public Name create( boolean value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Boolean.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public DateTime create( Path value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Path.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public DateTime create( Path.Segment value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Path.Segment.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public URI create( Calendar value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Calendar.class.getSimpleName(), value)); }
/** * {@inheritDoc} * * @see org.modeshape.graph.property.ValueFactory#create(org.modeshape.graph.property.DateTime) */ public URI create( DateTime value ) throws ValueFormatException { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), DateTime.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public Boolean create( float value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Float.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public Boolean create( Path.Segment value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Path.Segment.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public Boolean create( Reference value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Reference.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public Path create( double value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Double.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public Reference create( Path value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Path.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public Boolean create( double value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Double.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public Boolean create( BigDecimal value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), BigDecimal.class.getSimpleName(), value)); }
/** * {@inheritDoc} */ public Boolean create( Name value ) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.unableToCreateValue.text(getPropertyType().getName(), Name.class.getSimpleName(), value)); }
@Test public void shouldParseLiteralFromStringWithCastBooleanLiteralToBinary() { Binary binaryTrue = (Binary)typeSystem.getTypeFactory(PropertyType.BINARY.getName()).create(true); Binary binaryFalse = (Binary)typeSystem.getTypeFactory(PropertyType.BINARY.getName()).create(false); assertThat((Binary)parser.parseLiteral(tokens("CAST(true AS BINARY)"), typeSystem).value(), is(binaryTrue)); assertThat((Binary)parser.parseLiteral(tokens("CAST(false AS BINARY)"), typeSystem).value(), is(binaryFalse)); assertThat((Binary)parser.parseLiteral(tokens("CAST(TRUE AS BINARY)"), typeSystem).value(), is(binaryTrue)); assertThat((Binary)parser.parseLiteral(tokens("CAST(FALSE AS BINARY)"), typeSystem).value(), is(binaryFalse)); assertThat((Binary)parser.parseLiteral(tokens("CAST('true' AS biNarY)"), typeSystem).value(), is(binaryTrue)); assertThat((Binary)parser.parseLiteral(tokens("CAST(\"false\" AS binary)"), typeSystem).value(), is(binaryFalse)); }