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


Java XObject.getType方法代码示例

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


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

示例1: getTypeFromXObject

import com.sun.org.apache.xpath.internal.objects.XObject; //导入方法依赖的package包/类
/**
   * Given an XObject, determine the corresponding DOM XPath type
   *
   * @return type string
   */
  private short getTypeFromXObject(XObject object) {
      switch (object.getType()) {
        case XObject.CLASS_BOOLEAN: return BOOLEAN_TYPE;
        case XObject.CLASS_NODESET: return UNORDERED_NODE_ITERATOR_TYPE;
        case XObject.CLASS_NUMBER: return NUMBER_TYPE;
        case XObject.CLASS_STRING: return STRING_TYPE;
        // XPath 2.0 types
//          case XObject.CLASS_DATE:
//          case XObject.CLASS_DATETIME:
//          case XObject.CLASS_DTDURATION:
//          case XObject.CLASS_GDAY:
//          case XObject.CLASS_GMONTH:
//          case XObject.CLASS_GMONTHDAY:
//          case XObject.CLASS_GYEAR:
//          case XObject.CLASS_GYEARMONTH:
//          case XObject.CLASS_TIME:
//          case XObject.CLASS_YMDURATION: return STRING_TYPE; // treat all date types as strings?

        case XObject.CLASS_RTREEFRAG: return UNORDERED_NODE_ITERATOR_TYPE;
        case XObject.CLASS_NULL: return ANY_TYPE; // throw exception ?
        default: return ANY_TYPE; // throw exception ?
    }

  }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:XPathResultImpl.java

示例2: getLocalVariable

import com.sun.org.apache.xpath.internal.objects.XObject; //导入方法依赖的package包/类
/**
 * Get a local variable or parameter in the current stack frame.
 *
 *
 * @param xctxt The XPath context, which must be passed in order to
 * lazy evaluate variables.
 *
 * @param index Local variable index relative to the current stack
 * frame bottom.
 *
 * @return The value of the variable.
 *
 * @throws TransformerException
 */
public XObject getLocalVariable(XPathContext xctxt, int index)
        throws TransformerException
{

  index += _currentFrameBottom;

  XObject val = _stackFrames[index];

  if(null == val)
    throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VARIABLE_ACCESSED_BEFORE_BIND, null),
                   xctxt.getSAXLocator());
    // "Variable accessed before it is bound!", xctxt.getSAXLocator());

  // Lazy execution of variables.
  if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE)
    return (_stackFrames[index] = val.execute(xctxt));

  return val;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:VariableStack.java

示例3: getXPathResult

import com.sun.org.apache.xpath.internal.objects.XObject; //导入方法依赖的package包/类
/**
 * Construct an XPathExpressionResult object based on the result of the
 * evaluation and cast to the specified class type.
 * @param <T> The class type
 * @param resultObject the result of an evaluation
 * @param type The class type expected to be returned by the XPath expression.
 * @return an instance of the specified type or null if the XObject returned
 * an UNKNOWN object type.
 * @throws TransformerException if there is an error converting the result
 * to the specified type. It's unlikely to happen. This is mostly needed
 * by the internal XPath engine.
 */
<T> T getXPathResult(XObject resultObject, Class<T> type)
        throws TransformerException {
    int resultType = resultObject.getType();

    switch (resultType) {
        case XObject.CLASS_BOOLEAN :
            return type.cast(new XPathResultImpl<>(resultObject, Boolean.class));
        case XObject.CLASS_NUMBER :
            return type.cast(new XPathResultImpl<>(resultObject, Double.class));
        case XObject.CLASS_STRING :
            return type.cast(new XPathResultImpl<>(resultObject, String.class));
        case XObject.CLASS_NODESET :
            return type.cast(new XPathResultImpl<>(resultObject, XPathNodes.class));
        case XObject.CLASS_RTREEFRAG :  //NODE
            return type.cast(new XPathResultImpl<>(resultObject, Node.class));
    }

    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:XPathImplUtil.java

示例4: operate

import com.sun.org.apache.xpath.internal.objects.XObject; //导入方法依赖的package包/类
/**
 * Apply the operation to two operands, and return the result.
 *
 *
 * @param right non-null reference to the evaluated right operand.
 *
 * @return non-null reference to the XObject that represents the result of the operation.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject operate(XObject right) throws javax.xml.transform.TransformerException
{

  if (XObject.CLASS_BOOLEAN == right.getType())
    return right;
  else
    return right.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:Bool.java

示例5: operate

import com.sun.org.apache.xpath.internal.objects.XObject; //导入方法依赖的package包/类
/**
 * Apply the operation to two operands, and return the result.
 *
 *
 * @param right non-null reference to the evaluated right operand.
 *
 * @return non-null reference to the XObject that represents the result of the operation.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject operate(XObject right) throws javax.xml.transform.TransformerException
{

  if (XObject.CLASS_NUMBER == right.getType())
    return right;
  else
    return new XNumber(right.num());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:Number.java

示例6: getGlobalVariable

import com.sun.org.apache.xpath.internal.objects.XObject; //导入方法依赖的package包/类
/**
 * Get a global variable or parameter from the global stack frame.
 *
 *
 * @param xctxt The XPath context, which must be passed in order to
 * lazy evaluate variables.
 *
 * @param index Global variable index relative to the global stack
 * frame bottom.
 *
 * @return The value of the variable.
 *
 * @throws TransformerException
 */
public XObject getGlobalVariable(XPathContext xctxt, final int index)
        throws TransformerException
{

  XObject val = _stackFrames[index];

  // Lazy execution of variables.
  if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE)
    return (_stackFrames[index] = val.execute(xctxt));

  return val;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:VariableStack.java

示例7: XPathResultImpl

import com.sun.org.apache.xpath.internal.objects.XObject; //导入方法依赖的package包/类
/**
 * Construct an XPathEvaluationResult object.
 *
 * @param resultObject internal XPath result object
 * @param type class type
 * @throws TransformerException if there is an error reading the XPath
 * result.
 */
public XPathResultImpl(XObject resultObject, Class<T> type)
        throws TransformerException {
    this.resultObject = resultObject;
    resultType = resultObject.getType();
    this.type = type;
    getResult(resultObject);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:XPathResultImpl.java


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