本文整理汇总了Java中org.apache.olingo.commons.api.edm.EdmKeyPropertyRef.getName方法的典型用法代码示例。如果您正苦于以下问题:Java EdmKeyPropertyRef.getName方法的具体用法?Java EdmKeyPropertyRef.getName怎么用?Java EdmKeyPropertyRef.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.commons.api.edm.EdmKeyPropertyRef
的用法示例。
在下文中一共展示了EdmKeyPropertyRef.getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findPropertyRefValue
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef; //导入方法依赖的package包/类
private Object findPropertyRefValue(Entity entity, EdmKeyPropertyRef refType) {
final int INDEX_ERROR_CODE = -1;
final String propertyPath = refType.getName();
String tmpPropertyName;
int lastIndex;
int index = propertyPath.indexOf('/');
if (index == INDEX_ERROR_CODE) {
index = propertyPath.length();
}
tmpPropertyName = propertyPath.substring(0, index);
//get first property
Property prop = entity.getProperty(tmpPropertyName);
//get following properties
while (index < propertyPath.length()) {
lastIndex = ++index;
index = propertyPath.indexOf('/', index+1);
if (index == INDEX_ERROR_CODE) {
index = propertyPath.length();
}
tmpPropertyName = propertyPath.substring(lastIndex, index);
prop = findProperty(tmpPropertyName, prop.asComplex().getValue());
}
return prop.getValue();
}
示例2: findPropertyRefValue
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef; //导入方法依赖的package包/类
private Object findPropertyRefValue(Entity entity, EdmKeyPropertyRef refType) throws SerializerException {
final int INDEX_ERROR_CODE = -1;
final String propertyPath = refType.getName();
String tmpPropertyName;
int lastIndex;
int index = propertyPath.indexOf('/');
if (index == INDEX_ERROR_CODE) {
index = propertyPath.length();
}
tmpPropertyName = propertyPath.substring(0, index);
//get first property
Property prop = entity.getProperty(tmpPropertyName);
//get following properties
while (index < propertyPath.length()) {
lastIndex = ++index;
index = propertyPath.indexOf('/', index+1);
if (index == INDEX_ERROR_CODE) {
index = propertyPath.length();
}
tmpPropertyName = propertyPath.substring(lastIndex, index);
prop = findProperty(tmpPropertyName, prop.asComplex().getValue());
}
if (prop == null) {
throw new SerializerException("Key Value Cannot be null for property: " + propertyPath,
SerializerException.MessageKeys.WRONG_PROPERTY_VALUE, propertyPath);
}
return prop.getValue();
}
示例3: isKey
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef; //导入方法依赖的package包/类
private boolean isKey(EdmEntityType edmEntityType, String propertyName) {
List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
for (EdmKeyPropertyRef propRef : keyPropertyRefs) {
String keyPropertyName = propRef.getName();
if (keyPropertyName.equals(propertyName)) {
return true;
}
}
return false;
}
示例4: isKey
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef; //导入方法依赖的package包/类
private boolean isKey(EdmEntityType edmEntityType, String propertyName) {
List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
for (EdmKeyPropertyRef propRef : keyPropertyRefs) {
String keyPropertyName = propRef.getName();
if (keyPropertyName.equals(propertyName)) {
return true;
}
}
return false;
}