本文整理了Java中com.sun.org.apache.xpath.internal.objects.XObject.bool()
方法的一些代码示例,展示了XObject.bool()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XObject.bool()
方法的具体详情如下:
包路径:com.sun.org.apache.xpath.internal.objects.XObject
类名称:XObject
方法名:bool
[英]Cast result object to a boolean. Always issues an error.
[中]将结果对象强制转换为布尔值。总是发出错误。
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* Cast result object to a boolean, but allow side effects, such as the
* incrementing of an iterator.
*
* @return True if there is a next node in the nodeset
*/
public boolean boolWithSideEffects() throws javax.xml.transform.TransformerException
{
return bool();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/**
* Cast result object to a boolean, but allow side effects, such as the
* incrementing of an iterator.
*
* @return True if there is a next node in the nodeset
*/
public boolean boolWithSideEffects() throws javax.xml.transform.TransformerException
{
return bool();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/**
* Execute the function. The function must return
* a valid object.
* @param xctxt The current execution context.
* @return A valid XObject.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
return m_arg0.execute(xctxt).bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* Execute the function. The function must return
* a valid object.
* @param xctxt The current execution context.
* @return A valid XObject.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
return m_arg0.execute(xctxt).bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* Execute the function. The function must return
* a valid object.
* @param xctxt The current execution context.
* @return A valid XObject.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
return m_arg0.execute(xctxt).bool() ? XBoolean.S_FALSE : XBoolean.S_TRUE;
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/**
* Execute the function. The function must return
* a valid object.
* @param xctxt The current execution context.
* @return A valid XObject.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
return m_arg0.execute(xctxt).bool() ? XBoolean.S_FALSE : XBoolean.S_TRUE;
}
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* Evaluate expression to a boolean.
*
*
* @param xctxt The XPath runtime context.
* @return false
*
* @throws javax.xml.transform.TransformerException
*/
public boolean bool(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
return execute(xctxt).bool();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/**
* Evaluate expression to a boolean.
*
*
* @param xctxt The XPath runtime context.
* @return false
*
* @throws javax.xml.transform.TransformerException
*/
public boolean bool(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
return execute(xctxt).bool();
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* 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;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/**
* 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;
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* Tell if two objects are functionally equal.
*
* @param obj2 Object to compare to this
*
* @return True if the two objects are equal
*
* @throws javax.xml.transform.TransformerException
*/
public boolean equals(XObject obj2)
{
try
{
return m_val == obj2.bool();
}
catch(javax.xml.transform.TransformerException te)
{
throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(te);
}
}
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* OR two expressions and return the boolean result. Override
* superclass method for optimization purposes.
*
* @param xctxt The runtime execution context.
*
* @return {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_TRUE} or
* {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_FALSE}.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
XObject expr1 = m_left.execute(xctxt);
if (!expr1.bool())
{
XObject expr2 = m_right.execute(xctxt);
return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
else
return XBoolean.S_TRUE;
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* AND two expressions and return the boolean result. Override
* superclass method for optimization purposes.
*
* @param xctxt The runtime execution context.
*
* @return {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_TRUE} or
* {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_FALSE}.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
XObject expr1 = m_left.execute(xctxt);
if (expr1.bool())
{
XObject expr2 = m_right.execute(xctxt);
return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
else
return XBoolean.S_FALSE;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/**
* OR two expressions and return the boolean result. Override
* superclass method for optimization purposes.
*
* @param xctxt The runtime execution context.
*
* @return {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_TRUE} or
* {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_FALSE}.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
XObject expr1 = m_left.execute(xctxt);
if (!expr1.bool())
{
XObject expr2 = m_right.execute(xctxt);
return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
else
return XBoolean.S_TRUE;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/**
* Tell if two objects are functionally equal.
*
* @param obj2 Object to compare to this
*
* @return True if the two objects are equal
*
* @throws javax.xml.transform.TransformerException
*/
public boolean equals(XObject obj2)
{
try
{
return m_val == obj2.bool();
}
catch(javax.xml.transform.TransformerException te)
{
throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(te);
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/**
* AND two expressions and return the boolean result. Override
* superclass method for optimization purposes.
*
* @param xctxt The runtime execution context.
*
* @return {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_TRUE} or
* {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_FALSE}.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
XObject expr1 = m_left.execute(xctxt);
if (expr1.bool())
{
XObject expr2 = m_right.execute(xctxt);
return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
else
return XBoolean.S_FALSE;
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* Tell if two objects are functionally equal.
*
* @param obj2 Object to compare to this
*
* @return True if the two objects are equal
*
* @throws javax.xml.transform.TransformerException
*/
public boolean equals(XObject obj2)
{
// In order to handle the 'all' semantics of
// nodeset comparisons, we always call the
// nodeset function.
if (obj2.getType() == XObject.CLASS_NODESET)
return obj2.equals(this);
try
{
return m_val == obj2.bool();
}
catch(javax.xml.transform.TransformerException te)
{
throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(te);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/**
* Tell if two objects are functionally equal.
*
* @param obj2 Object to compare to this
*
* @return True if the two objects are equal
*
* @throws javax.xml.transform.TransformerException
*/
public boolean equals(XObject obj2)
{
// In order to handle the 'all' semantics of
// nodeset comparisons, we always call the
// nodeset function.
if (obj2.getType() == XObject.CLASS_NODESET)
return obj2.equals(this);
try
{
return m_val == obj2.bool();
}
catch(javax.xml.transform.TransformerException te)
{
throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(te);
}
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
/**
* @see org.w3c.dom.xpath.XPathResult#getBooleanValue()
*/
public boolean getBooleanValue() throws XPathException {
if (getResultType() != BOOLEAN_TYPE) {
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_BOOLEAN, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});
throw new XPathException(XPathException.TYPE_ERR,fmsg);
// "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a boolean."
} else {
try {
return m_resultObj.bool();
} catch (TransformerException e) {
// Type check above should prevent this exception from occurring.
throw new XPathException(XPathException.TYPE_ERR,e.getMessage());
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
/**
* @see org.w3c.dom.xpath.XPathResult#getBooleanValue()
*/
public boolean getBooleanValue() throws XPathException {
if (getResultType() != BOOLEAN_TYPE) {
String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_BOOLEAN, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});
throw new XPathException(XPathException.TYPE_ERR,fmsg);
// "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a boolean."
} else {
try {
return m_resultObj.bool();
} catch (TransformerException e) {
// Type check above should prevent this exception from occurring.
throw new XPathException(XPathException.TYPE_ERR,e.getMessage());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!