@Test(expected=DatatypeCohercionException.class) public void testNewTypedLiteral$duration$cohercionFailure$string() throws DatatypeConfigurationException { checkDurationLiteral(Literals.newTypedLiteral("invalid",Datatypes.DURATION)); }
public static TypedLiteral<? extends Serializable> newTypedLiteral(Object value, URI datatype) { checkNotNull(value,LITERAL_VALUE_CANNOT_BE_NULL); checkNotNull(datatype,DATATYPE_CANNOT_BE_NULL); TypedLiteral<? extends Serializable> result=null; if(Datatypes.isDuration(datatype)) { result=coherceDuration(value); } else if(Datatypes.isTemporal(datatype)) { result=coherceDateTime(value, datatype); } else if(value instanceof Serializable){ result=new ImmutableTypedLiteral<Serializable>((Serializable)value,datatype); } else { result=new ImmutableTypedLiteral<String>(value.toString(),Datatypes.STRING); } return result; }
Literals { public static TypedLiteral<? extends Serializable> newTypedLiteral(Object value, URI datatype) { checkNotNull(value,LITERAL_VALUE_CANNOT_BE_NULL); checkNotNull(datatype,DATATYPE_CANNOT_BE_NULL); TypedLiteral<? extends Serializable> result=null; if(Datatypes.isDuration(datatype)) { result=coherceDuration(value); } else if(Datatypes.isTemporal(datatype)) { result=coherceDateTime(value, datatype); } else if(value instanceof Serializable){ result=new ImmutableTypedLiteral<Serializable>((Serializable)value,datatype); } else { result=new ImmutableTypedLiteral<String>(value.toString(),Datatypes.STRING); } return result; } }
Literals { public static TypedLiteral<? extends Serializable> newTypedLiteral(Object value, URI datatype) { checkNotNull(value,LITERAL_VALUE_CANNOT_BE_NULL); checkNotNull(datatype,DATATYPE_CANNOT_BE_NULL); TypedLiteral<? extends Serializable> result=null; if(Datatypes.isDuration(datatype)) { result=coherceDuration(value); } else if(Datatypes.isTemporal(datatype)) { result=coherceDateTime(value, datatype); } else if(value instanceof Serializable){ result=new ImmutableTypedLiteral<Serializable>((Serializable)value,datatype); } else { result=new ImmutableTypedLiteral<String>(value.toString(),Datatypes.STRING); } return result; } private  Literals(); }
Literals { public static TypedLiteral<? extends Serializable> newTypedLiteral(Object value, URI datatype) { checkNotNull(value,LITERAL_VALUE_CANNOT_BE_NULL); checkNotNull(datatype,DATATYPE_CANNOT_BE_NULL); TypedLiteral<? extends Serializable> result=null; if(Datatypes.isDuration(datatype)) { result=coherceDuration(value); } else if(Datatypes.isTemporal(datatype)) { result=coherceDateTime(value, datatype); } else if(value instanceof Serializable){ result=new ImmutableTypedLiteral<Serializable>((Serializable)value,datatype); } else { result=new ImmutableTypedLiteral<String>(value.toString(),Datatypes.STRING); } return result; } private  Literals(); static Literal<String> of(String value); static DurationLiteral of(javax.xml.datatype.Duration duration); static DurationLiteral of(Duration duration); static DateTimeDateTimeLiteralBuilder of(Date date); static DateTimeLiteral of(java.sql.Date date); static DateTimeLiteral of(java.sql.Time time); static DateTimeDateTimeLiteralBuilder of(Calendar calendar); static DateTimeDateTimeLiteralBuilder of(GregorianCalendar calendar); static XMLGregorianCalendarDateTimeLiteralBuilder of(XMLGregorianCalendar calendar); static DateTimeDateTimeLiteralBuilder of(DateTime dateTime); static DurationLiteral duration(long time, TimeUnit unit); static Literal<? extends Serializable> newLiteral(Object value); static TypedLiteral<? extends Serializable> newTypedLiteral(Object value, URI datatype); static LanguageLiteral newLanguageLiteral(String value, String language); }
Literals { public static TypedLiteral<? extends Serializable> newTypedLiteral(Object value, URI datatype) { checkNotNull(value,LITERAL_VALUE_CANNOT_BE_NULL); checkNotNull(datatype,DATATYPE_CANNOT_BE_NULL); TypedLiteral<? extends Serializable> result=null; if(Datatypes.isDuration(datatype)) { result=coherceDuration(value); } else if(Datatypes.isTemporal(datatype)) { result=coherceDateTime(value, datatype); } else if(value instanceof Serializable){ result=new ImmutableTypedLiteral<Serializable>((Serializable)value,datatype); } else { result=new ImmutableTypedLiteral<String>(value.toString(),Datatypes.STRING); } return result; } private  Literals(); static Literal<String> of(String value); static DurationLiteral of(javax.xml.datatype.Duration duration); static DurationLiteral of(Duration duration); static DateTimeDateTimeLiteralBuilder of(Date date); static DateTimeLiteral of(java.sql.Date date); static DateTimeLiteral of(java.sql.Time time); static DateTimeDateTimeLiteralBuilder of(Calendar calendar); static DateTimeDateTimeLiteralBuilder of(GregorianCalendar calendar); static XMLGregorianCalendarDateTimeLiteralBuilder of(XMLGregorianCalendar calendar); static DateTimeDateTimeLiteralBuilder of(DateTime dateTime); static DurationLiteral duration(long time, TimeUnit unit); static Literal<? extends Serializable> newLiteral(Object value); static TypedLiteral<? extends Serializable> newTypedLiteral(Object value, URI datatype); static LanguageLiteral newLanguageLiteral(String value, String language);  }