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


Java EdmType.equals方法代码示例

本文整理汇总了Java中org.apache.olingo.commons.api.edm.EdmType.equals方法的典型用法代码示例。如果您正苦于以下问题:Java EdmType.equals方法的具体用法?Java EdmType.equals怎么用?Java EdmType.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.olingo.commons.api.edm.EdmType的用法示例。


在下文中一共展示了EdmType.equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkEqualityTypes

import org.apache.olingo.commons.api.edm.EdmType; //导入方法依赖的package包/类
private void checkEqualityTypes(final Expression left, final Expression right) throws UriParserException {
  checkNoCollection(left);
  checkNoCollection(right);

  final EdmType leftType = getType(left);
  final EdmType rightType = getType(right);
  if (leftType == null || rightType == null || leftType.equals(rightType)) {
    return;
  }

  // Numeric promotion for Edm.Byte and Edm.SByte
  if (isType(leftType, EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte)
      && isType(rightType, EdmPrimitiveTypeKind.Byte, EdmPrimitiveTypeKind.SByte)) {
    return;
  }

  if (leftType.getKind() != EdmTypeKind.PRIMITIVE
      || rightType.getKind() != EdmTypeKind.PRIMITIVE
      || !(((EdmPrimitiveType) leftType).isCompatible((EdmPrimitiveType) rightType)
      || ((EdmPrimitiveType) rightType).isCompatible((EdmPrimitiveType) leftType))) {
    throw new UriParserSemanticException("Incompatible types.",
        UriParserSemanticException.MessageKeys.TYPES_NOT_COMPATIBLE,
        leftType.getFullQualifiedName().getFullQualifiedNameAsString(),
        rightType.getFullQualifiedName().getFullQualifiedNameAsString());
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:ExpressionParser.java

示例2: castToCommonType

import org.apache.olingo.commons.api.edm.EdmType; //导入方法依赖的package包/类
public TypedOperand castToCommonType(final VisitorOperand otherOperand) throws ODataApplicationException {
  final TypedOperand other = otherOperand.asTypedOperand();
  final EdmType oType = other.getType();
  
  // In case of numberic values make sure that the EDM type is equal, check also the java type.
  // It is possible that there is an conversion even if the same EdmType is provided.
  // For example consider an Edm.Int32 (internal Integer) and an Edm.Int16 (internal Short) value:
  // shortInstance.equals(intInstance) will always be false!
  if (type == oType && value != null && other.getValue() != null
      && value.getClass() == other.getValue().getClass()) {
    return this;
  } else if (is(primNull) || other.is(primNull)) {
    return this;
  }

  if (type.equals(primDouble) || oType.equals(primDouble)) {
    return asTypedOperand(primDouble);
  } else if (type.equals(primSingle) || oType.equals(primSingle)) {
    return asTypedOperand(primSingle);
  } else if (type.equals(primDecimal) || oType.equals(primDecimal)) {
    return asTypedOperand(primDecimal);
  } else if (type.equals(primInt64) || oType.equals(primInt64)) {
    return asTypedOperand(primInt64);
  } else if (type.equals(primInt32) || oType.equals(primInt32)) {
    return asTypedOperand(primInt32);
  } else if (type.equals(primInt16) || oType.equals(primInt16)) {
    return asTypedOperand(primInt16);
  } else {
    return asTypedOperand((EdmPrimitiveType) type);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:32,代码来源:TypedOperand.java

示例3: parse

import org.apache.olingo.commons.api.edm.EdmType; //导入方法依赖的package包/类
public FilterOption parse(UriTokenizer tokenizer, final EdmType referencedType,
    final Collection<String> crossjoinEntitySetNames, final Map<String, AliasQueryOption> aliases)
    throws UriParserException, UriValidationException {
  final Expression filterExpression = new ExpressionParser(edm, odata)
      .parse(tokenizer, referencedType, crossjoinEntitySetNames, aliases);
  final EdmType type = ExpressionParser.getType(filterExpression);
  if (type == null || type.equals(odata.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Boolean))) {
    return new FilterOptionImpl().setExpression(filterExpression);
  } else {
    throw new UriParserSemanticException("Filter expressions must be boolean.",
        UriParserSemanticException.MessageKeys.TYPES_NOT_COMPATIBLE,
        "Edm.Boolean", type.getFullQualifiedName().getFullQualifiedNameAsString());
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:15,代码来源:FilterParser.java

示例4: isType

import org.apache.olingo.commons.api.edm.EdmType; //导入方法依赖的package包/类
private boolean isType(final EdmType type, final EdmPrimitiveTypeKind... kinds) throws UriParserException {
  if (type == null) {
    return true;
  }
  for (final EdmPrimitiveTypeKind kind : kinds) {
    if (type.equals(odata.createPrimitiveTypeInstance(kind))) {
      return true;
    }
  }
  return false;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:12,代码来源:ExpressionParser.java

示例5: parseAliasValue

import org.apache.olingo.commons.api.edm.EdmType; //导入方法依赖的package包/类
protected static AliasQueryOption parseAliasValue(final String name, final EdmType type, final boolean isNullable,
    final boolean isCollection, final Edm edm, final EdmType referringType,
    final Map<String, AliasQueryOption> aliases) throws UriParserException, UriValidationException {
  final EdmTypeKind kind = type == null ? null : type.getKind();
  final AliasQueryOption alias = aliases.get(name);
  if (alias != null && alias.getText() != null) {
    UriTokenizer aliasTokenizer = new UriTokenizer(alias.getText());
    if (kind == null
        || !((isCollection || kind == EdmTypeKind.COMPLEX || kind == EdmTypeKind.ENTITY ?
        aliasTokenizer.next(TokenKind.jsonArrayOrObject) :
        nextPrimitiveTypeValue(aliasTokenizer, (EdmPrimitiveType) type, isNullable))
        && aliasTokenizer.next(TokenKind.EOF))) {
      // The alias value is not an allowed literal value, so parse it again as expression.
      aliasTokenizer = new UriTokenizer(alias.getText());
      // Don't pass on the current alias to avoid circular references.
      Map<String, AliasQueryOption> aliasesInner = new HashMap<String, AliasQueryOption>(aliases);
      aliasesInner.remove(name);
      final Expression expression = new ExpressionParser(edm, odata)
          .parse(aliasTokenizer, referringType, null, aliasesInner);
      final EdmType expressionType = ExpressionParser.getType(expression);
      if (aliasTokenizer.next(TokenKind.EOF)
          && (expressionType == null || type == null || expressionType.equals(type))) {
        ((AliasQueryOptionImpl) alias).setAliasValue(expression);
      } else {
        throw new UriParserSemanticException("Illegal value for alias '" + alias.getName() + "'.",
            UriParserSemanticException.MessageKeys.UNKNOWN_PART, alias.getText());
      }
    }
  }
  return alias;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:32,代码来源:ParserHelper.java

示例6: castToCommonType

import org.apache.olingo.commons.api.edm.EdmType; //导入方法依赖的package包/类
public TypedOperand castToCommonType(final VisitorOperand otherOperand) throws ODataApplicationException {
    final TypedOperand other = otherOperand.asTypedOperand();
    final EdmType oType = other.getType();
    // In case of numeric values make sure that the EDM type is equals, check also the java type.
    // So it is possible, that there is an conversation even if the same
    // EdmType is provided.
    // For example consider an Edm16 (internal Integer) and Edm16(internal
    // Short)
    // shortInstance.equals(intInstance) will always be false!
    if (type == oType && value != null && other.getValue() != null &&
        value.getClass() == other.getValue().getClass()) {
        return this;
    } else if (is(ODataConstants.primitiveNull) || other.is(ODataConstants.primitiveNull)) {
        return this;
    }
    if (type.equals(ODataConstants.primitiveDouble) || oType.equals(ODataConstants.primitiveDouble)) {
        return asTypedOperand(ODataConstants.primitiveDouble);
    } else if (type.equals(ODataConstants.primitiveSingle) || oType.equals(ODataConstants.primitiveSingle)) {
        return asTypedOperand(ODataConstants.primitiveSingle);
    } else if (type.equals(ODataConstants.primitiveDecimal) || oType.equals(ODataConstants.primitiveDecimal)) {
        return asTypedOperand(ODataConstants.primitiveDecimal);
    } else if (type.equals(ODataConstants.primitiveInt64) || oType.equals(ODataConstants.primitiveInt64)) {
        return asTypedOperand(ODataConstants.primitiveInt64);
    } else if (type.equals(ODataConstants.primitiveInt32) || oType.equals(ODataConstants.primitiveInt32)) {
        return asTypedOperand(ODataConstants.primitiveInt32);
    } else if (type.equals(ODataConstants.primitiveInt16) || oType.equals(ODataConstants.primitiveInt16)) {
        return asTypedOperand(ODataConstants.primitiveInt16);
    } else {
        return asTypedOperand((EdmPrimitiveType) type);
    }
}
 
开发者ID:wso2,项目名称:carbon-data,代码行数:32,代码来源:TypedOperand.java


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