gpt4 book ai didi

com.bagri.support.util.XQUtils.getBaseTypeForTypeName()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 00:21:05 27 4
gpt4 key购买 nike

本文整理了Java中com.bagri.support.util.XQUtils.getBaseTypeForTypeName()方法的一些代码示例,展示了XQUtils.getBaseTypeForTypeName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XQUtils.getBaseTypeForTypeName()方法的具体详情如下:
包路径:com.bagri.support.util.XQUtils
类名称:XQUtils
方法名:getBaseTypeForTypeName

XQUtils.getBaseTypeForTypeName介绍

[英]converts QName to the corresponding XQJ baseType. Return XQBASETYPE_STRING if the provided typeName's local name is not recognized. Return XQBASETYPE_ANYTYPE if the provided typeName is not from standard xs: namespace.
[中]将QName转换为相应的XQJ基类型。如果无法识别提供的typeName的本地名称,则返回XQBASETYPE_字符串。如果提供的typeName不是来自标准xs:namespace,则返回XQBASETYPE_ANYTYPE。

代码示例

代码示例来源:origin: dsukhoroslov/bagri

/**
 * converts {@link QName} to the corresponding XQJ baseType. 
 * Return XQBASETYPE_STRING if the provided typeName's local name is not recognized.
 * Return XQBASETYPE_ANYTYPE if the provided typeName is not from standard xs: namespace.
 * 
 * @param typeName the QName type representation 
 * @return one of XQJ base type constants
 */
public static int getBaseTypeForTypeName(QName typeName) {
  if (xs_ns.equals(typeName.getNamespaceURI())) {
    return getBaseTypeForTypeName(typeName.getLocalPart());
  }
  return XQBASETYPE_ANYTYPE;
}

代码示例来源:origin: dsukhoroslov/bagri

/**
 * checks if the provided type name constant corresponds to any XQJ base types or not 
 * 
 * @param typeName one of XQJ type names 
 * @return true if the {@code typeName} corresponds to XQJ base type, false otherwise
 */
public static boolean isBaseType(String typeName) {
  return !isComplexType(typeName) && getBaseTypeForTypeName(typeName) > 0;
}

代码示例来源:origin: dsukhoroslov/bagri

public static Object getAtomicValue(String typeName, String value) {
  int baseType = getBaseTypeForTypeName(typeName);
  return getAtomicValue(baseType, value);
}

代码示例来源:origin: dsukhoroslov/bagri

private int getBaseType(XSTypeDefinition std) {
  if (std == null) {
    return XQItemType.XQBASETYPE_ANYSIMPLETYPE;
  }
  if (xs_ns.equals(std.getNamespace())) {
    QName qn = new QName(std.getNamespace(), std.getName());
    int type = getBaseTypeForTypeName(qn);
    logger.trace("getBaseType; returning {} for type {}", type, std.getName());
    return type;
  }
  return getBaseType(std.getBaseType());
}

代码示例来源:origin: dsukhoroslov/bagri

private Object getIndexedValue(Index idx, int pathId, Object value) {
  int baseType = getBaseTypeForTypeName(idx.getDataType());
  if (isStringTypeCompatible(baseType)) {
    value = value.toString();
    if (!idx.isCaseSensitive()) {
      value = ((String) value).toLowerCase();
    }
  } else {
    Path xPath = mdlMgr.getPath(pathId);
    if (xPath.getDataType() != baseType) {
      logger.info("getIndexedValue; index [{}] and path [{}] types are not compatible; Index: {}; path: {}; value: {}({})", 
          baseType, xPath.getDataType(), idx, pathId, value.getClass().getName(), value);
      try {
        // conversion from path type to index type
        value = getAtomicValue(baseType, value.toString());
      } catch (Exception ex) {
        // just log error and use old value
        logger.error("getIndexedValue.error: " + ex, ex);
      }
    }
  }
  return value;
}

代码示例来源:origin: dsukhoroslov/bagri

private void bindParams(Map<String, Parameter> params, XQDynamicContext xqe) throws XQException {
  for (Map.Entry<String, Parameter> e: params.entrySet()) {
    Parameter param = e.getValue();
    //if ("properties".equals(param.getType())) {
      // create and bind sequence with properties
    //	Properties props;
    //	try {
    //		props = propsFromString(param.getName());
    //	} catch (IOException ex) {
    //		logger.warn("bindParams.error; " + ex, ex);
    //		continue;
    //	}
      //XQItemType type = getConnection().createAtomicType(baseType, typeName, null);
      //XQSequence seq = getConnection().createSequence((java.util.Iterator) null);
      //xqe.bindSequence(new QName(e.getKey()), seq);
    //	XQSequenceType type = getConnection().createSequenceType(getConnection().createItemType(), XQSequenceType.OCC_ZERO_OR_MORE);
          //getConnection().createSequenceType(
          //		getConnection().createAtomicType(XQItemType.XQBASETYPE_STRING), XQSequenceType.OCC_ZERO_OR_MORE), XQSequenceType.OCC_ZERO_OR_MORE);
      //xqe.bindObject(new QName(e.getKey()), props, type);
    //} else {
      QName typeName = new QName(xs_ns, param.getType(), xs_prefix);
      int baseType = getBaseTypeForTypeName(typeName);
      XQItemType type = getConnection().createAtomicType(baseType, typeName, null);
      //xqe.bindAtomicValue(new QName(e.getKey()), param.getName(), type);
      xqe.bindObject(new QName(e.getKey()), getAtomicValue(baseType, param.getName()), type);
    //}
  }
}

代码示例来源:origin: dsukhoroslov/bagri

xqpe.bindString(new QName("sect"), "Technology", null); 
QName typeName = new QName(xs_ns, "decimal", xs_prefix);
int baseType = getBaseTypeForTypeName(typeName);
XQItemType type = xqc.createAtomicType(baseType, typeName, null);

代码示例来源:origin: dsukhoroslov/bagri

private Set<Integer> getPathsForIndex(Index index) throws BagriException {
  String path = index.getPath();
  Set<Integer> result;
  if (PathBuilder.isRegexPath(path)) {
    // replace {}
    result = mdlMgr.translatePathFromRegex(index.getDocumentType(), PathBuilder.regexFromPath(path));
  } else {
    int dataType = XQUtils.getBaseTypeForTypeName(index.getDataType());
    Path xPath = mdlMgr.translatePath(index.getDocumentType(), path, NodeKind.fromPath(path), 0, dataType, Occurrence.zeroOrOne);
    result = new HashSet<>(1);
    result.add(xPath.getPathId());
  }
  logger.trace("getPathsForIndex; returning {} for index {}", result, index);
  return result;
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com