in odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/ep/deserializer/XmlMetadataDeserializer.java [1137:1184]
private EdmFacets readFacets(final XMLStreamReader reader) throws XMLStreamException {
String isNullable = reader.getAttributeValue(null, XmlMetadataConstants.EDM_PROPERTY_NULLABLE);
String maxLength = reader.getAttributeValue(null, XmlMetadataConstants.EDM_PROPERTY_MAX_LENGTH);
String precision = reader.getAttributeValue(null, XmlMetadataConstants.EDM_PROPERTY_PRECISION);
String scale = reader.getAttributeValue(null, XmlMetadataConstants.EDM_PROPERTY_SCALE);
String isFixedLength = reader.getAttributeValue(null, XmlMetadataConstants.EDM_PROPERTY_FIXED_LENGTH);
String isUnicode = reader.getAttributeValue(null, XmlMetadataConstants.EDM_PROPERTY_UNICODE);
String concurrencyMode = reader.getAttributeValue(null, XmlMetadataConstants.EDM_PROPERTY_CONCURRENCY_MODE);
String defaultValue = reader.getAttributeValue(null, XmlMetadataConstants.EDM_PROPERTY_DEFAULT_VALUE);
String collation = reader.getAttributeValue(null, XmlMetadataConstants.EDM_PROPERTY_COLLATION);
if (isNullable != null || maxLength != null || precision != null || scale != null || isFixedLength != null
|| isUnicode != null || concurrencyMode != null || defaultValue != null || collation != null) {
EdmFacets facets = new Facets();
if (isNullable != null) {
((Facets) facets).setNullable("true".equalsIgnoreCase(isNullable));
}
if (maxLength != null) {
if (XmlMetadataConstants.EDM_PROPERTY_MAX_LENGTH_MAX_VALUE_FIRST_UPPERCASE.equals(maxLength)
|| XmlMetadataConstants.EDM_PROPERTY_MAX_LENGTH_MAX_VALUE_LOWERCASE.equals(maxLength)) {
((Facets) facets).setMaxLength(Integer.MAX_VALUE);
} else {
((Facets) facets).setMaxLength(Integer.parseInt(maxLength));
}
}
if (precision != null) {
((Facets) facets).setPrecision(Integer.parseInt(precision));
}
if (scale != null) {
((Facets) facets).setScale(Integer.parseInt(scale));
}
if (isFixedLength != null) {
((Facets) facets).setFixedLength("true".equalsIgnoreCase(isFixedLength));
}
if (isUnicode != null) {
((Facets) facets).setUnicode("true".equalsIgnoreCase(isUnicode));
}
for (int i = 0; i < EdmConcurrencyMode.values().length; i++) {
if (EdmConcurrencyMode.values()[i].name().equalsIgnoreCase(concurrencyMode)) {
((Facets) facets).setConcurrencyMode(EdmConcurrencyMode.values()[i]);
}
}
((Facets) facets).setDefaultValue(defaultValue);
((Facets) facets).setCollation(collation);
return facets;
} else {
return null;
}
}