本文整理汇总了Java中org.apache.olingo.commons.api.edm.EdmProperty.isUnicode方法的典型用法代码示例。如果您正苦于以下问题:Java EdmProperty.isUnicode方法的具体用法?Java EdmProperty.isUnicode怎么用?Java EdmProperty.isUnicode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.commons.api.edm.EdmProperty
的用法示例。
在下文中一共展示了EdmProperty.isUnicode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: facetsFrom
import org.apache.olingo.commons.api.edm.EdmProperty; //导入方法依赖的package包/类
/** Sets all facets from an EDM property. */
public Builder facetsFrom(final EdmProperty property) {
options.isNullable = property.isNullable();
options.maxLength = property.getMaxLength();
options.precision = property.getPrecision();
options.scale = property.getScale();
options.isUnicode = property.isUnicode();
return this;
}
示例2: appendProperties
import org.apache.olingo.commons.api.edm.EdmProperty; //导入方法依赖的package包/类
private void appendProperties(final JsonGenerator json,
final EdmStructuredType type) throws SerializerException, IOException {
List<String> propertyNames = new ArrayList<String>(type.getPropertyNames());
if (type.getBaseType() != null) {
propertyNames.removeAll(type.getBaseType().getPropertyNames());
}
for (String propertyName : propertyNames) {
EdmProperty property = type.getStructuralProperty(propertyName);
json.writeObjectFieldStart(propertyName);
String fqnString;
if (property.isPrimitive()) {
fqnString = getFullQualifiedName(property.getType());
} else {
fqnString = getAliasedFullQualifiedName(property.getType());
}
json.writeStringField(TYPE, fqnString);
if (property.isCollection()) {
json.writeBooleanField(COLLECTION, property.isCollection());
}
// Facets
if (!property.isNullable()) {
json.writeBooleanField(NULLABLE, property.isNullable());
}
if (!property.isUnicode()) {
json.writeBooleanField(UNICODE, property.isUnicode());
}
if (property.getDefaultValue() != null) {
json.writeStringField(DEFAULT_VALUE, property.getDefaultValue());
}
if (property.getMaxLength() != null) {
json.writeNumberField(MAX_LENGTH, property.getMaxLength());
}
if (property.getPrecision() != null) {
json.writeNumberField(PRECISION, property.getPrecision());
}
if (property.getScale() != null) {
json.writeNumberField(SCALE, property.getScale());
}
appendAnnotations(json, property, null);
json.writeEndObject();
}
}
示例3: appendProperties
import org.apache.olingo.commons.api.edm.EdmProperty; //导入方法依赖的package包/类
private void appendProperties(final XMLStreamWriter writer, final EdmStructuredType type) throws XMLStreamException {
List<String> propertyNames = new ArrayList<String>(type.getPropertyNames());
if (type.getBaseType() != null) {
propertyNames.removeAll(type.getBaseType().getPropertyNames());
}
for (String propertyName : propertyNames) {
EdmProperty property = type.getStructuralProperty(propertyName);
writer.writeStartElement(XML_PROPERTY);
writer.writeAttribute(XML_NAME, propertyName);
String fqnString;
if (property.isPrimitive()) {
fqnString = getFullQualifiedName(property.getType(), property.isCollection());
} else {
fqnString = getAliasedFullQualifiedName(property.getType(), property.isCollection());
}
writer.writeAttribute(XML_TYPE, fqnString);
// Facets
if (!property.isNullable()) {
writer.writeAttribute(XML_NULLABLE, "" + property.isNullable());
}
if (!property.isUnicode()) {
writer.writeAttribute(XML_UNICODE, "" + property.isUnicode());
}
if (property.getDefaultValue() != null) {
writer.writeAttribute(XML_DEFAULT_VALUE, property.getDefaultValue());
}
if (property.getMaxLength() != null) {
writer.writeAttribute(XML_MAX_LENGTH, "" + property.getMaxLength());
}
if (property.getPrecision() != null) {
writer.writeAttribute(XML_PRECISION, "" + property.getPrecision());
}
if (property.getScale() != null) {
writer.writeAttribute(XML_SCALE, "" + property.getScale());
}
appendAnnotations(writer, property);
writer.writeEndElement();
}
}
示例4: entityMatchesAllKeys
import org.apache.olingo.commons.api.edm.EdmProperty; //导入方法依赖的package包/类
public static boolean
entityMatchesAllKeys(EdmEntityType edmEntityType, Entity rt_entity, List<UriParameter> keyParams)
throws ODataApplicationException {
// loop over all keys
for (final UriParameter key : keyParams) {
// key
String keyName = key.getName();
String keyText = key.getText();
// Edm: we need this info for the comparison below
EdmProperty edmKeyProperty = (EdmProperty) edmEntityType.getProperty(keyName);
Boolean isNullable = edmKeyProperty.isNullable();
Integer maxLength = edmKeyProperty.getMaxLength();
Integer precision = edmKeyProperty.getPrecision();
Boolean isUnicode = edmKeyProperty.isUnicode();
Integer scale = edmKeyProperty.getScale();
// get the EdmType in order to compare
EdmType edmType = edmKeyProperty.getType();
// if(EdmType instanceof EdmPrimitiveType) // do we need this?
EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmType;
// Runtime data: the value of the current entity
// don't need to check for null, this is done in olingo library
Object valueObject = rt_entity.getProperty(keyName).getValue();
// now need to compare the valueObject with the keyText String
// this is done using type.valueToString
String valueAsString = null;
try {
valueAsString = edmPrimitiveType.valueToString(valueObject, isNullable, maxLength, precision, scale, isUnicode);
} catch (EdmPrimitiveTypeException e) {
throw new ODataApplicationException("Failed to retrieve String value",
HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ENGLISH, e);
}
if (valueAsString == null) {
return false;
}
boolean matches = valueAsString.equals(keyText);
if (!matches) {
// if any of the key properties is not found in the entity, we don't need to search further
return false;
}
}
return true;
}
示例5: entityMatchesAllKeys
import org.apache.olingo.commons.api.edm.EdmProperty; //导入方法依赖的package包/类
public static boolean entityMatchesAllKeys(EdmEntityType edmEntityType, Entity entity, List<UriParameter> keyParams)
throws ODataApplicationException {
// loop over all keys
for (final UriParameter key : keyParams) {
// key
String keyName = key.getName();
String keyText = key.getText();
// Edm: we need this info for the comparison below
EdmProperty edmKeyProperty = (EdmProperty) edmEntityType.getProperty(keyName);
Boolean isNullable = edmKeyProperty.isNullable();
Integer maxLength = edmKeyProperty.getMaxLength();
Integer precision = edmKeyProperty.getPrecision();
Boolean isUnicode = edmKeyProperty.isUnicode();
Integer scale = edmKeyProperty.getScale();
// get the EdmType in order to compare
EdmType edmType = edmKeyProperty.getType();
EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmType;
// Runtime data: the value of the current entity
// don't need to check for null, this is done in olingo library
Object valueObject = entity.getProperty(keyName).getValue();
// now need to compare the valueObject with the keyText String
// this is done using the type.valueToString
String valueAsString;
try {
valueAsString = edmPrimitiveType.valueToString(valueObject, isNullable, maxLength, precision, scale, isUnicode);
} catch (EdmPrimitiveTypeException e) {
throw new ODataApplicationException("Failed to retrieve String value", HttpStatusCode.INTERNAL_SERVER_ERROR
.getStatusCode(), Locale.ENGLISH, e);
}
if (valueAsString == null) {
return false;
}
boolean matches = valueAsString.equals(keyText);
if (!matches) {
// if any of the key properties is not found in the entity, we don't need to search further
return false;
}
}
return true;
}
示例6: entityMatchesAllKeys
import org.apache.olingo.commons.api.edm.EdmProperty; //导入方法依赖的package包/类
public static boolean entityMatchesAllKeys(EdmEntityType edmEntityType, Entity entity, List<UriParameter> keyParams)
throws ODataApplicationException {
// loop over all keys
for (final UriParameter key : keyParams) {
// key
String keyName = key.getName();
String keyText = key.getText();
// Edm: we need this info for the comparison below
EdmProperty edmKeyProperty = (EdmProperty) edmEntityType.getProperty(keyName);
Boolean isNullable = edmKeyProperty.isNullable();
Integer maxLength = edmKeyProperty.getMaxLength();
Integer precision = edmKeyProperty.getPrecision();
Boolean isUnicode = edmKeyProperty.isUnicode();
Integer scale = edmKeyProperty.getScale();
// get the EdmType in order to compare
EdmType edmType = edmKeyProperty.getType();
EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmType;
// Runtime data: the value of the current entity
// don't need to check for null, this is done in olingo library
Object valueObject = entity.getProperty(keyName).getValue();
// now need to compare the valueObject with the keyText String
// this is done using the type.valueToString //
String valueAsString = null;
try {
valueAsString = edmPrimitiveType.valueToString(valueObject, isNullable, maxLength, precision, scale, isUnicode);
} catch (EdmPrimitiveTypeException e) {
throw new ODataApplicationException("Failed to retrieve String value", HttpStatusCode.INTERNAL_SERVER_ERROR
.getStatusCode(), Locale.ENGLISH, e);
}
if (valueAsString == null) {
return false;
}
boolean matches = valueAsString.equals(keyText);
if (!matches) {
// if any of the key properties is not found in the entity, we don't need to search further
return false;
}
}
return true;
}
示例7: entityMatchesAllKeys
import org.apache.olingo.commons.api.edm.EdmProperty; //导入方法依赖的package包/类
public static boolean entityMatchesAllKeys(EdmEntityType edmEntityType, Entity rt_entity,
List<UriParameter> keyParams) {
// loop over all keys
for (final UriParameter key : keyParams) {
// key
String keyName = key.getName();
String keyText = key.getText();
// note: below line doesn't consider: keyProp can be part of a complexType in V4
// in such case, it would be required to access it via getKeyPropertyRef()
// but since this isn't the case in our model, we ignore it in our implementation
EdmProperty edmKeyProperty = (EdmProperty) edmEntityType.getProperty(keyName);
// Edm: we need this info for the comparison below
Boolean isNullable = edmKeyProperty.isNullable();
Integer maxLength = edmKeyProperty.getMaxLength();
Integer precision = edmKeyProperty.getPrecision();
Boolean isUnicode = edmKeyProperty.isUnicode();
Integer scale = edmKeyProperty.getScale();
// get the EdmType in order to compare
EdmType edmType = edmKeyProperty.getType();
// if(EdmType instanceof EdmPrimitiveType) // do we need this?
EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmType;
// Runtime data: the value of the current entity
// don't need to check for null, this is done in FWK
Object valueObject = rt_entity.getProperty(keyName).getValue();
// TODO if the property is a complex type
// now need to compare the valueObject with the keyText String
// this is done using the type.valueToString
String valueAsString = null;
try {
valueAsString = edmPrimitiveType.valueToString(valueObject, isNullable,
maxLength, precision, scale, isUnicode);
} catch (EdmPrimitiveTypeException e) {
return false; // TODO proper Exception handling
}
if (valueAsString == null) {
return false;
}
boolean matches = valueAsString.equals(keyText);
// if any of the key properties is not found in the entity, we don't need to search further
if (!matches) {
return false;
}
// if the given key value is found in the current entity, continue with the next key
}
return true;
}
示例8: entityMatchesAllKeys
import org.apache.olingo.commons.api.edm.EdmProperty; //导入方法依赖的package包/类
public static boolean entityMatchesAllKeys(EdmEntityType edmEntityType, Entity entity, List<UriParameter> keyParams)
throws ODataApplicationException {
// loop over all keys
for (final UriParameter key : keyParams) {
// key
String keyName = key.getName();
String keyText = key.getText();
// Edm: we need this info for the comparison below
EdmProperty edmKeyProperty = (EdmProperty) edmEntityType.getProperty(keyName);
Boolean isNullable = edmKeyProperty.isNullable();
Integer maxLength = edmKeyProperty.getMaxLength();
Integer precision = edmKeyProperty.getPrecision();
Boolean isUnicode = edmKeyProperty.isUnicode();
Integer scale = edmKeyProperty.getScale();
// get the EdmType in order to compare
EdmType edmType = edmKeyProperty.getType();
EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmType;
// Runtime data: the value of the current entity
// don't need to check for null, this is done in olingo library
Object valueObject = entity.getProperty(keyName).getValue();
// now need to compare the valueObject with the keyText String
// this is done using the type.valueToString //
String valueAsString = null;
try {
valueAsString = edmPrimitiveType.valueToString(valueObject, isNullable, maxLength, precision, scale, isUnicode);
} catch (EdmPrimitiveTypeException e) {
throw new ODataApplicationException("Failed to retrieve String value", HttpStatusCode.INTERNAL_SERVER_ERROR
.getStatusCode(), Locale.ENGLISH, e);
}
if (valueAsString == null) {
return false;
}
boolean matches = valueAsString.equals(keyText);
if (!matches) {
// if any of the key properties is not found in the entity, we don't need to search further
return false;
}
}
return true;
}
示例9: entityMatchesAllKeys
import org.apache.olingo.commons.api.edm.EdmProperty; //导入方法依赖的package包/类
public static boolean entityMatchesAllKeys(EdmEntityType edmEntityType, Entity rt_entity,
List<UriParameter> keyParams) {
// loop over all keys
for (final UriParameter key : keyParams) {
// key
String keyName = key.getName();
String keyText = key.getText();
// note: below line doesn't consider: keyProp can be part of a complexType in V4
// in such case, it would be required to access it via getKeyPropertyRef()
// but since this isn't the case in our model, we ignore it in our implementation
EdmProperty edmKeyProperty = (EdmProperty) edmEntityType.getProperty(keyName);
// Edm: we need this info for the comparison below
Boolean isNullable = edmKeyProperty.isNullable();
Integer maxLength = edmKeyProperty.getMaxLength();
Integer precision = edmKeyProperty.getPrecision();
Boolean isUnicode = edmKeyProperty.isUnicode();
Integer scale = edmKeyProperty.getScale();
// get the EdmType in order to compare
EdmType edmType = edmKeyProperty.getType();
// if(EdmType instanceof EdmPrimitiveType) // do we need this?
EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmType;
// Runtime data: the value of the current entity
// don't need to check for null, this is done in FWK
Object valueObject = rt_entity.getProperty(keyName).getValue();
// TODO if the property is a complex type
// now need to compare the valueObject with the keyText String
// this is done using the type.valueToString
String valueAsString = null;
try {
valueAsString = edmPrimitiveType.valueToString(valueObject, isNullable,
maxLength, precision, scale, isUnicode);
} catch (EdmPrimitiveTypeException e) {
return false; // TODO proper Exception handling
}
if (valueAsString == null) {
return false;
}
boolean matches = valueAsString.equals(keyText);
if (matches) {
// if the given key value is found in the current entity, continue with the next key
continue;
} else {
// if any of the key properties is not found in the entity, we don't need to search further
return false;
}
}
return true;
}