@Test public void shouldNotCreateDateFromDoubleValue() { assertThat(factory.create(10000.12345d), is((new ModeShapeDateTime(10000)))); }
@Override public DateTime create( String value ) { if (value == null) return null; try { return new ModeShapeDateTime(value.trim()); } catch (java.time.format.DateTimeParseException err) { try { Long longValue = Long.parseLong(value); return new ModeShapeDateTime(longValue); } catch (NumberFormatException e) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.errorConvertingType.text(String.class.getSimpleName(), org.modeshape.jcr.api.value.DateTime.class.getSimpleName(), value), err); } } }
ModeShapeDateTimeValueFactory extends AbstractValueFactory<DateTime> implements DateTimeFactory { @Override public DateTime create( String value ) { if (value == null) return null; try { return new ModeShapeDateTime(value.trim()); } catch (java.time.format.DateTimeParseException err) { try { Long longValue = Long.parseLong(value); return new ModeShapeDateTime(longValue); } catch (NumberFormatException e) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.errorConvertingType.text(String.class.getSimpleName(), org.modeshape.jcr.api.value.DateTime.class.getSimpleName(), value), err); } } } }
ModeShapeDateTimeValueFactory extends AbstractValueFactory<DateTime> implements DateTimeFactory { @Override public DateTime create( String value ) { if (value == null) return null; try { return new ModeShapeDateTime(value.trim()); } catch (java.time.format.DateTimeParseException err) { try { Long longValue = Long.parseLong(value); return new ModeShapeDateTime(longValue); } catch (NumberFormatException e) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.errorConvertingType.text(String.class.getSimpleName(), org.modeshape.jcr.api.value.DateTime.class.getSimpleName(), value), err); } } } ModeShapeDateTimeValueFactory( TextDecoder decoder,
                                          ValueFactories factories ); }
ModeShapeDateTimeValueFactory extends AbstractValueFactory<DateTime> implements DateTimeFactory { @Override public DateTime create( String value ) { if (value == null) return null; try { return new ModeShapeDateTime(value.trim()); } catch (java.time.format.DateTimeParseException err) { try { Long longValue = Long.parseLong(value); return new ModeShapeDateTime(longValue); } catch (NumberFormatException e) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.errorConvertingType.text(String.class.getSimpleName(), org.modeshape.jcr.api.value.DateTime.class.getSimpleName(), value), err); } } } ModeShapeDateTimeValueFactory( TextDecoder decoder,
                                          ValueFactories factories ); @Override DateTimeFactory with( ValueFactories valueFactories ); @Override DateTime create( String value ); @Override DateTime create( String value,
                            TextDecoder decoder ); @Override DateTime create( int value ); @Override DateTime create( long value ); @Override DateTime create( boolean value ); @Override DateTime create( float value ); @Override DateTime create( double value ); @Override DateTime create( BigDecimal value ); @Override DateTime create( Calendar value ); @Override DateTime create( Date value ); @Override DateTime create( DateTime value ); @Override DateTime create( Name value ); @Override DateTime create( Path value ); @Override DateTime create( Path.Segment value ); @Override DateTime create( Reference value ); @Override DateTime create( URI value ); @Override DateTime create( UUID value ); @Override DateTime create( NodeKey value ); @Override DateTime create( byte[] value ); @Override DateTime create( BinaryValue value ); @Override DateTime create( InputStream stream ); @Override DateTime create(); @Override DateTime createUtc(); @Override DateTime create( int year,
                            int monthOfYear,
                            int dayOfMonth,
                            int hourOfDay,
                            int minuteOfHour,
                            int secondOfMinute,
                            int millisecondsOfSecond ); @Override DateTime create( DateTime original,
                            long offsetInMillis ); @Override DateTime[] createEmptyArray( int length ); }
ModeShapeDateTimeValueFactory extends AbstractValueFactory<DateTime> implements DateTimeFactory { @Override public DateTime create( String value ) { if (value == null) return null; try { return new ModeShapeDateTime(value.trim()); } catch (java.time.format.DateTimeParseException err) { try { Long longValue = Long.parseLong(value); return new ModeShapeDateTime(longValue); } catch (NumberFormatException e) { throw new ValueFormatException(value, getPropertyType(), GraphI18n.errorConvertingType.text(String.class.getSimpleName(), org.modeshape.jcr.api.value.DateTime.class.getSimpleName(), value), err); } } } ModeShapeDateTimeValueFactory( TextDecoder decoder,
                                          ValueFactories factories ); @Override DateTimeFactory with( ValueFactories valueFactories ); @Override DateTime create( String value ); @Override DateTime create( String value,
                            TextDecoder decoder ); @Override DateTime create( int value ); @Override DateTime create( long value ); @Override DateTime create( boolean value ); @Override DateTime create( float value ); @Override DateTime create( double value ); @Override DateTime create( BigDecimal value ); @Override DateTime create( Calendar value ); @Override DateTime create( Date value ); @Override DateTime create( DateTime value ); @Override DateTime create( Name value ); @Override DateTime create( Path value ); @Override DateTime create( Path.Segment value ); @Override DateTime create( Reference value ); @Override DateTime create( URI value ); @Override DateTime create( UUID value ); @Override DateTime create( NodeKey value ); @Override DateTime create( byte[] value ); @Override DateTime create( BinaryValue value ); @Override DateTime create( InputStream stream ); @Override DateTime create(); @Override DateTime createUtc(); @Override DateTime create( int year,
                            int monthOfYear,
                            int dayOfMonth,
                            int hourOfDay,
                            int minuteOfHour,
                            int secondOfMinute,
                            int millisecondsOfSecond ); @Override DateTime create( DateTime original,
                            long offsetInMillis ); @Override DateTime[] createEmptyArray( int length );  }