List of usage examples for org.joda.time IllegalFieldValueException IllegalFieldValueException
public IllegalFieldValueException(String fieldName, String value)
From source file:org.jsonschema2pojo.rules.polimorphic.util.PolymorphicUtils.java
License:Apache License
/** * Get value of discriminator type, return default PROPERTY strategy if bas * value assigned/*from ww w. j a v a 2 s . c om*/ * * @param nodeAnnotation * @return */ public static JsonTypeInfo.As getIncludeValue(JsonNode nodeAnnotation) { JsonTypeInfo.As includeDiscriminatorType = JsonTypeInfo.As.PROPERTY; boolean hasIncludeValueType = nodeAnnotation.has(JSON_INCLUDE_ATTR_NAME); if (hasIncludeValueType) { JsonNode jsonNode = nodeAnnotation.get(JSON_INCLUDE_ATTR_NAME); JsonTypeInfo.As nodeValue = JsonTypeInfo.As.valueOf(jsonNode.asText()); if (includeDiscriminatorType == null) { throw new IllegalFieldValueException(JSON_INCLUDE_ATTR_NAME, jsonNode.asText()); } includeDiscriminatorType = nodeValue; } return includeDiscriminatorType; }
From source file:org.jsonschema2pojo.rules.polimorphic.util.PolymorphicUtils.java
License:Apache License
/** * Get value of Id, return default PROPERTY strategy if bas value assigned * //from w w w .j a v a 2s . c o m * @param nodeAnnotation * @return */ public static JsonTypeInfo.Id getIdValue(JsonNode nodeAnnotation) { JsonTypeInfo.Id idType = JsonTypeInfo.Id.CLASS; boolean hasIncludeValueType = nodeAnnotation.has(JSON_ID_ATTR_NAME); if (hasIncludeValueType) { JsonNode jsonNode = nodeAnnotation.get(JSON_ID_ATTR_NAME); JsonTypeInfo.Id nodeValue = JsonTypeInfo.Id.valueOf(jsonNode.asText()); if (idType == null) { throw new IllegalFieldValueException(JSON_ID_ATTR_NAME, jsonNode.asText()); } idType = nodeValue; } return idType; }