当前位置: 首页>>代码示例>>Java>>正文


Java EdmKeyPropertyRef.getName方法代码示例

本文整理汇总了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();
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:25,代码来源:DataProvider.java

示例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();
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:29,代码来源:UriHelperImpl.java

示例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;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:12,代码来源:Storage.java

示例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;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:11,代码来源:Storage.java


注:本文中的org.apache.olingo.commons.api.edm.EdmKeyPropertyRef.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。