@Override public boolean validate(final String value, final EdmLiteralKind literalKind, final EdmFacets facets) { try { valueOfString(value, literalKind, facets, getDefaultType()); return true; } catch (final EdmSimpleTypeException e) { return false; } }
@Override public boolean isCompatible(final EdmSimpleType simpleType) { return equals(simpleType); }
@Override public String toString() { try { return getNamespace() + Edm.DELIMITER + getName(); } catch (final EdmException e) { return super.toString(); } } }
@Override public final String valueToString(final Object value, final EdmLiteralKind literalKind, final EdmFacets facets) throws EdmSimpleTypeException { if (value == null) { if (facets == null || facets.isNullable() == null || facets.isNullable()) { return null; } else { throw new EdmSimpleTypeException(EdmSimpleTypeException.VALUE_NULL_NOT_ALLOWED); } } if (literalKind == null) { throw new EdmSimpleTypeException(EdmSimpleTypeException.LITERAL_KIND_MISSING); } final String result = internalValueToString(value, literalKind, facets); return literalKind == EdmLiteralKind.URI ? toUriLiteral(result) : result; }
/** * For internal use only by data model classes */ @Override public T read( final JsonReader in ) throws IOException { if( in.peek() == JsonToken.STRING ) { final String jsonValue = in.nextString(); try { return getSimpleTypeInstance().valueOfString(jsonValue, EdmLiteralKind.JSON, null, getValueType()); } catch( final EdmSimpleTypeException e ) { logger.error( String.format( "Problem while parsing JSON string to %s. Returning null instead.", getValueType().getSimpleName()), e); return null; } } else { in.skipValue(); return null; } } }
@Override public final <T> T valueOfString(final String value, final EdmLiteralKind literalKind, final EdmFacets facets, final Class<T> returnType) throws EdmSimpleTypeException { if (value == null) { if (facets == null || facets.isNullable() == null || facets.isNullable()) { return null; } else { throw new EdmSimpleTypeException(EdmSimpleTypeException.LITERAL_NULL_NOT_ALLOWED); } } if (literalKind == null) { throw new EdmSimpleTypeException(EdmSimpleTypeException.LITERAL_KIND_MISSING); } return internalValueOfString(value, literalKind, facets, returnType); }
@Override public final String valueToString(final Object value, final EdmLiteralKind literalKind, final EdmFacets facets) throws EdmSimpleTypeException { if (value == null) { if (facets == null || facets.isNullable() == null || facets.isNullable()) { return null; } else { throw new EdmSimpleTypeException(EdmSimpleTypeException.VALUE_NULL_NOT_ALLOWED); } } if (literalKind == null) { throw new EdmSimpleTypeException(EdmSimpleTypeException.LITERAL_KIND_MISSING); } final String result = internalValueToString(value, literalKind, facets); return literalKind == EdmLiteralKind.URI ? toUriLiteral(result) : result; }
@Override public final <T> T valueOfString(final String value, final EdmLiteralKind literalKind, final EdmFacets facets, final Class<T> returnType) throws EdmSimpleTypeException { if (value == null) { if (facets == null || facets.isNullable() == null || facets.isNullable()) { return null; } else { throw new EdmSimpleTypeException(EdmSimpleTypeException.LITERAL_NULL_NOT_ALLOWED); } } if (literalKind == null) { throw new EdmSimpleTypeException(EdmSimpleTypeException.LITERAL_KIND_MISSING); } return internalValueOfString(value, literalKind, facets, returnType); }
@Override public boolean validate(final String value, final EdmLiteralKind literalKind, final EdmFacets facets) { try { valueOfString(value, literalKind, facets, getDefaultType()); return true; } catch (final EdmSimpleTypeException e) { return false; } }
@Override public String toString() { try { return getNamespace() + Edm.DELIMITER + getName(); } catch (final EdmException e) { return super.toString(); } } }
@Override public final String valueToString(final Object value, final EdmLiteralKind literalKind, final EdmFacets facets) throws EdmSimpleTypeException { if (value == null) { if (facets == null || facets.isNullable() == null || facets.isNullable()) { return null; } else { throw new EdmSimpleTypeException(EdmSimpleTypeException.VALUE_NULL_NOT_ALLOWED); } } if (literalKind == null) { throw new EdmSimpleTypeException(EdmSimpleTypeException.LITERAL_KIND_MISSING); } final String result = internalValueToString(value, literalKind, facets); return literalKind == EdmLiteralKind.URI ? toUriLiteral(result) : result; }
@Override public boolean isCompatible(final EdmSimpleType simpleType) { return equals(simpleType); }
@Override public final <T> T valueOfString(final String value, final EdmLiteralKind literalKind, final EdmFacets facets, final Class<T> returnType) throws EdmSimpleTypeException { if (value == null) { if (facets == null || facets.isNullable() == null || facets.isNullable()) { return null; } else { throw new EdmSimpleTypeException(EdmSimpleTypeException.LITERAL_NULL_NOT_ALLOWED); } } if (literalKind == null) { throw new EdmSimpleTypeException(EdmSimpleTypeException.LITERAL_KIND_MISSING); } return internalValueOfString(value, literalKind, facets, returnType); }
@Override public boolean validate(final String value, final EdmLiteralKind literalKind, final EdmFacets facets) { try { valueOfString(value, literalKind, facets, getDefaultType()); return true; } catch (final EdmSimpleTypeException e) { return false; } }
@Override public String toString() { try { return getNamespace() + Edm.DELIMITER + getName(); } catch (final EdmException e) { return super.toString(); } } }
@Override public boolean isCompatible(final EdmSimpleType simpleType) { return equals(simpleType); }