You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2007/12/17 08:29:46 UTC
svn commit: r604783 [3/3] - in
/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath: ./
functions/ ri/ ri/axes/ ri/compiler/ ri/model/ ri/model/beans/
ri/model/container/ ri/model/dom/ ri/model/dynamic/ ri/model/jdom/
ri/parser/ servlet/ uti...
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNamespaceIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNamespaceIterator.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNamespaceIterator.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNamespaceIterator.java Sun Dec 16 23:29:28 2007
@@ -37,12 +37,21 @@
private List attributes;
private int position = 0;
+ /**
+ * Create a new DOMNamespaceIterator.
+ * @param parent parent pointer
+ */
public DOMNamespaceIterator(NodePointer parent) {
this.parent = parent;
attributes = new ArrayList();
collectNamespaces(attributes, (Node) parent.getNode());
}
+ /**
+ * Collect namespaces from attribute nodes.
+ * @param attributes attribute list
+ * @param node target node
+ */
private void collectNamespaces(List attributes, Node node) {
Node parent = node.getParentNode();
if (parent != null) {
@@ -66,6 +75,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer getNodePointer() {
if (position == 0) {
if (!setPosition(1)) {
@@ -86,10 +98,16 @@
return new NamespacePointer(parent, prefix, attr.getValue());
}
+ /**
+ * {@inheritDoc}
+ */
public int getPosition() {
return position;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean setPosition(int position) {
this.position = position;
return position >= 1 && position <= attributes.size();
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodeIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodeIterator.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodeIterator.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodeIterator.java Sun Dec 16 23:29:28 2007
@@ -39,7 +39,7 @@
NodePointer parent,
NodeTest nodeTest,
boolean reverse,
- NodePointer startWith)
+ NodePointer startWith)
{
this.parent = parent;
this.node = (Node) parent.getNode();
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java Sun Dec 16 23:29:28 2007
@@ -54,16 +54,16 @@
public class DOMNodePointer extends NodePointer {
private static final long serialVersionUID = -8751046933894857319L;
-
+
private Node node;
private Map namespaces;
private String defaultNamespace;
private String id;
private NamespaceResolver localNamespaceResolver;
- public static final String XML_NAMESPACE_URI =
+ public static final String XML_NAMESPACE_URI =
"http://www.w3.org/XML/1998/namespace";
- public static final String XMLNS_NAMESPACE_URI =
+ public static final String XMLNS_NAMESPACE_URI =
"http://www.w3.org/2000/xmlns/";
public DOMNodePointer(Node node, Locale locale) {
@@ -81,7 +81,7 @@
super(parent);
this.node = node;
}
-
+
public boolean testNode(NodeTest test) {
return testNode(node, test);
}
@@ -168,7 +168,7 @@
public NodeIterator childIterator(
NodeTest test,
boolean reverse,
- NodePointer startWith)
+ NodePointer startWith)
{
return new DOMNodeIterator(this, test, reverse, startWith);
}
@@ -242,7 +242,7 @@
if (namespace == UNKNOWN_NAMESPACE) {
return null;
}
-
+
// TBD: We are supposed to resolve relative URIs to absolute ones.
return namespace;
}
@@ -373,11 +373,11 @@
}
}
}
-
+
public NodePointer createChild(
JXPathContext context,
QName name,
- int index)
+ int index)
{
if (index == WHOLE_COLLECTION) {
index = 0;
@@ -392,7 +392,7 @@
if (success) {
NodeTest nodeTest;
String prefix = name.getPrefix();
- String namespaceURI = prefix == null ? null :
+ String namespaceURI = prefix == null ? null :
context.getNamespaceURI(prefix);
nodeTest = new NodeNameTest(name, namespaceURI);
@@ -406,7 +406,7 @@
+ "/" + name + "[" + (index + 1) + "]");
}
- public NodePointer createChild(JXPathContext context,
+ public NodePointer createChild(JXPathContext context,
QName name, int index, Object value)
{
NodePointer ptr = createChild(context, name, index);
@@ -548,7 +548,7 @@
}
return count;
}
-
+
private int getRelativePositionOfElement() {
int count = 1;
Node n = node.getPreviousSibling();
@@ -616,7 +616,7 @@
int index = name.lastIndexOf(':');
return index < 0 ? name : name.substring(index + 1);
}
-
+
public static String getNamespaceURI(Node node) {
if (node instanceof Document) {
node = ((Document) node).getDocumentElement();
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMPointerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMPointerFactory.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMPointerFactory.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dom/DOMPointerFactory.java Sun Dec 16 23:29:28 2007
@@ -31,25 +31,33 @@
*/
public class DOMPointerFactory implements NodePointerFactory {
+ /** factory order */
public static final int DOM_POINTER_FACTORY_ORDER = 100;
+ /**
+ * {@inheritDoc}
+ */
public int getOrder() {
return DOM_POINTER_FACTORY_ORDER;
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer createNodePointer(
QName name,
Object bean,
- Locale locale)
- {
+ Locale locale) {
return bean instanceof Node ? new DOMNodePointer((Node) bean, locale) : null;
}
+ /**
+ * {@inheritDoc}
+ */
public NodePointer createNodePointer(
NodePointer parent,
QName name,
- Object bean)
- {
+ Object bean) {
return bean instanceof Node ? new DOMNodePointer(parent, (Node) bean) : null;
}
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicAttributeIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicAttributeIterator.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicAttributeIterator.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicAttributeIterator.java Sun Dec 16 23:29:28 2007
@@ -24,7 +24,7 @@
* <code>DynamicAttributeIterator</code> is different from a regular
* <code>BeanAttributeIterator</code> in that given a property name it
* will always find that property (albeit with a null value).
- *
+ *
* @author <a href="mailto:dmitri@apache.org">Dmitri Plotnikov</a>
* @version $Id$
*/
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPointer.java Sun Dec 16 23:29:28 2007
@@ -40,77 +40,120 @@
private Object bean;
private DynamicPropertyHandler handler;
+ /**
+ * Create a new DynamicPointer.
+ * @param name property name
+ * @param bean owning bean
+ * @param handler DynamicPropertyHandler
+ * @param locale Locale
+ */
public DynamicPointer(QName name, Object bean,
- DynamicPropertyHandler handler, Locale locale)
- {
+ DynamicPropertyHandler handler, Locale locale) {
super(null, locale);
this.name = name;
this.bean = bean;
this.handler = handler;
}
+ /**
+ * Create a new DynamicPointer.
+ * @param parent parent pointer
+ * @param name property name
+ * @param bean owning bean
+ * @param handler DynamicPropertyHandler
+ */
public DynamicPointer(NodePointer parent, QName name,
- Object bean, DynamicPropertyHandler handler)
- {
+ Object bean, DynamicPropertyHandler handler) {
super(parent);
this.name = name;
this.bean = bean;
this.handler = handler;
}
+ /**
+ * {@inheritDoc}
+ */
public PropertyPointer getPropertyPointer() {
return new DynamicPropertyPointer(this, handler);
}
+ /**
+ * {@inheritDoc}
+ */
public NodeIterator createNodeIterator(
- String property, boolean reverse, NodePointer startWith)
- {
+ String property, boolean reverse, NodePointer startWith) {
return new PropertyIterator(this, property, reverse, startWith);
}
+ /**
+ * {@inheritDoc}
+ */
public NodeIterator attributeIterator(QName name) {
return new DynamicAttributeIterator(this, name);
}
+ /**
+ * {@inheritDoc}
+ */
public QName getName() {
return name;
}
-
+
+ /**
+ * {@inheritDoc}
+ */
public boolean isDynamicPropertyDeclarationSupported() {
return true;
}
-
+
/**
* Returns the DP object iself.
+ * @return Object
*/
public Object getBaseValue() {
return bean;
}
-
+
+ /**
+ * {@inheritDoc}
+ */
public boolean isLeaf() {
Object value = getNode();
return value == null || JXPathIntrospector.getBeanInfo(value.getClass()).isAtomic();
- }
-
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public boolean isCollection() {
return false;
}
/**
* Returns 1.
+ * @return int
*/
public int getLength() {
return 1;
}
+ /**
+ * {@inheritDoc}
+ */
public String asPath() {
return parent == null ? "/" : super.asPath();
}
+ /**
+ * {@inheritDoc}
+ */
public int hashCode() {
return System.identityHashCode(bean) + name.hashCode();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean equals(Object object) {
if (object == this) {
return true;
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPropertyPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPropertyPointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPropertyPointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/dynamic/DynamicPropertyPointer.java Sun Dec 16 23:29:28 2007
@@ -38,7 +38,7 @@
public class DynamicPropertyPointer extends PropertyPointer {
private static final long serialVersionUID = -5720585681149150822L;
-
+
private DynamicPropertyHandler handler;
private String name;
private String[] names;
@@ -46,7 +46,7 @@
public DynamicPropertyPointer(
NodePointer parent,
- DynamicPropertyHandler handler)
+ DynamicPropertyHandler handler)
{
super(parent);
this.handler = handler;
@@ -230,10 +230,10 @@
handler.setProperty(getBean(), getPropertyName(), collection);
}
}
-
+
return this;
}
-
+
public NodePointer createPath(JXPathContext context, Object value) {
if (index == WHOLE_COLLECTION) {
handler.setProperty(getBean(), getPropertyName(), value);
@@ -267,7 +267,7 @@
handler.setProperty(bean, getPropertyName(), null);
}
}
-
+
public String asPath() {
StringBuffer buffer = new StringBuffer();
buffer.append(getImmediateParentPointer().asPath());
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNamespacePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNamespacePointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNamespacePointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNamespacePointer.java Sun Dec 16 23:29:28 2007
@@ -29,41 +29,69 @@
private String prefix;
private String namespaceURI;
+ /**
+ * Create a new JDOMNamespacePointer.
+ * @param parent parent pointer
+ * @param prefix ns prefix
+ */
public JDOMNamespacePointer(NodePointer parent, String prefix) {
super(parent);
this.prefix = prefix;
}
+ /**
+ * Create a new JDOMNamespacePointer.
+ * @param parent parent pointer
+ * @param prefix ns prefix
+ * @param namespaceURI ns URI
+ */
public JDOMNamespacePointer(
NodePointer parent,
String prefix,
- String namespaceURI)
- {
+ String namespaceURI) {
super(parent);
this.prefix = prefix;
this.namespaceURI = namespaceURI;
}
+ /**
+ * {@inheritDoc}
+ */
public QName getName() {
return new QName(prefix);
}
+ /**
+ * {@inheritDoc}
+ */
public Object getBaseValue() {
return null;
}
-
+
+ /**
+ * {@inheritDoc}
+ */
public boolean isCollection() {
return false;
}
-
+
+ /**
+ * {@inheritDoc}
+ */
public int getLength() {
return 1;
- }
+ }
+ /**
+ * {@inheritDoc}
+ */
public Object getImmediateNode() {
return getNamespaceURI();
}
+ /**
+ * {@inheritDoc}
+ */
public String getNamespaceURI() {
if (namespaceURI == null) {
namespaceURI = parent.getNamespaceURI(prefix);
@@ -71,17 +99,24 @@
return namespaceURI;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isLeaf() {
return true;
}
/**
* Throws UnsupportedOperationException.
+ * @param value Object value to set
*/
public void setValue(Object value) {
throw new UnsupportedOperationException("Cannot modify a namespace");
}
+ /**
+ * {@inheritDoc}
+ */
public String asPath() {
StringBuffer buffer = new StringBuffer();
if (parent != null) {
@@ -96,18 +131,26 @@
return buffer.toString();
}
+ /**
+ * {@inheritDoc}
+ */
public int hashCode() {
return prefix.hashCode();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean equals(Object object) {
return object == this || object instanceof JDOMNamespacePointer && prefix.equals(((JDOMNamespacePointer) object).prefix);
}
+ /**
+ * {@inheritDoc}
+ */
public int compareChildNodePointers(
NodePointer pointer1,
- NodePointer pointer2)
- {
+ NodePointer pointer2) {
// Won't happen - namespaces don't have children
return 0;
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java Sun Dec 16 23:29:28 2007
@@ -79,7 +79,7 @@
public NodeIterator childIterator(
NodeTest test,
boolean reverse,
- NodePointer startWith)
+ NodePointer startWith)
{
return new JDOMNodeIterator(this, test, reverse, startWith);
}
@@ -99,7 +99,7 @@
public String getNamespaceURI() {
return getNamespaceURI(node);
}
-
+
private static String getNamespaceURI(Object node) {
if (node instanceof Element) {
Element element = (Element) node;
@@ -129,7 +129,7 @@
}
Element element = null;
if (node instanceof Document) {
- element = ((Document) node).getRootElement();
+ element = ((Document) node).getRootElement();
}
if (node instanceof Element) {
element = (Element) node;
@@ -143,7 +143,7 @@
public int compareChildNodePointers(
NodePointer pointer1,
- NodePointer pointer2)
+ NodePointer pointer2)
{
Object node1 = pointer1.getBaseValue();
Object node2 = pointer2.getBaseValue();
@@ -207,10 +207,10 @@
public boolean isCollection() {
return false;
}
-
+
public int getLength() {
return 1;
- }
+ }
public boolean isLeaf() {
if (node instanceof Element) {
@@ -320,8 +320,8 @@
}
}
}
- }
-
+ }
+
private void addContent(List content) {
Element element = (Element) node;
int count = content.size();
@@ -350,15 +350,15 @@
}
}
}
-
+
public boolean testNode(NodeTest test) {
return testNode(this, node, test);
}
-
+
public static boolean testNode(
NodePointer pointer,
Object node,
- NodeTest test)
+ NodeTest test)
{
if (test == null) {
return true;
@@ -426,7 +426,7 @@
}
return null;
}
-
+
public static String getLocalName(Object node) {
if (node instanceof Element) {
return ((Element) node).getName();
@@ -488,7 +488,7 @@
public NodePointer createChild(
JXPathContext context,
QName name,
- int index)
+ int index)
{
if (index == WHOLE_COLLECTION) {
index = 0;
@@ -584,7 +584,7 @@
}
String nsURI = getNamespaceURI();
String ln = JDOMNodePointer.getLocalName(node);
-
+
if (nsURI == null) {
buffer.append(ln);
buffer.append('[');
@@ -651,7 +651,7 @@
if (!(parent instanceof Element)) {
return 1;
}
-
+
List children = ((Element)parent).getContent();
int count = 0;
String name = ((Element) node).getQualifiedName();
@@ -669,7 +669,7 @@
}
return 1;
}
-
+
private int getRelativePositionOfElement() {
Object parent = ((Element) node).getParent();
if (parent == null) {
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/ParseException.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/ParseException.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/ParseException.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/ParseException.java Sun Dec 16 23:29:28 2007
@@ -121,7 +121,7 @@
break;
}
retval += add_escapes(tok.image);
- tok = tok.next;
+ tok = tok.next;
}
retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
retval += "." + eol;
@@ -138,7 +138,7 @@
* The end of line string for this machine.
*/
protected String eol = System.getProperty("line.separator", "\n");
-
+
/**
* Used to convert raw characters to their escaped version
* when these raw version cannot be used as part of an ASCII
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/SimpleCharStream.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/SimpleCharStream.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/SimpleCharStream.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/SimpleCharStream.java Sun Dec 16 23:29:28 2007
@@ -194,7 +194,7 @@
}
/**
- * @deprecated
+ * @deprecated
* @see #getEndColumn
*/
@@ -203,7 +203,7 @@
}
/**
- * @deprecated
+ * @deprecated
* @see #getEndLine
*/
@@ -378,7 +378,7 @@
bufcolumn[j] = newCol + columnDiff;
columnDiff = nextColDiff;
i++;
- }
+ }
if (i < len)
{
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/TokenMgrError.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/TokenMgrError.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/TokenMgrError.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/TokenMgrError.java Sun Dec 16 23:29:28 2007
@@ -1,5 +1,5 @@
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 *
- *
+ *
* !!!MODIFIED BY DMITRI PLOTNIKOV - DO NOT REGENERATE!!!
*/
package org.apache.commons.jxpath.ri.parser;
@@ -88,7 +88,7 @@
/**
* Returns a detailed message for the Error when it is thrown by the
* token manager to indicate a lexical error.
- * Parameters :
+ * Parameters :
* EOFSeen : indicates if EOF caused the lexicl error
* curLexState : lexical state in which this error occured
* errorLine : line number when the error occured
@@ -108,7 +108,7 @@
/**
* You can also modify the body of this method to customize your error messages.
* For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
+ * of end-users concern, so you can return something like :
*
* "Internal Error : Please file a bug report .... "
*
@@ -137,7 +137,7 @@
position = errorColumn - 1;
character = curChar;
}
-
+
private int position;
private char character;
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/XPathParserTokenManager.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/XPathParserTokenManager.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/XPathParserTokenManager.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/parser/XPathParserTokenManager.java Sun Dec 16 23:29:28 2007
@@ -536,7 +536,7 @@
private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(0, old0, old1);
+ return jjStartNfa_0(0, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(1, active0, active1);
@@ -598,7 +598,7 @@
private final int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(1, old0, old1);
+ return jjStartNfa_0(1, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(2, active0, active1);
@@ -659,7 +659,7 @@
private final int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(2, old0, old1);
+ return jjStartNfa_0(2, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(3, active0, active1);
@@ -705,7 +705,7 @@
private final int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(3, old0, old1);
+ return jjStartNfa_0(3, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(4, active0, active1);
@@ -760,7 +760,7 @@
private final int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(4, old0, old1);
+ return jjStartNfa_0(4, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(5, active0, active1);
@@ -806,7 +806,7 @@
private final int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(5, old0, old1);
+ return jjStartNfa_0(5, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(6, active0, active1);
@@ -850,7 +850,7 @@
private final int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(6, old0, old1);
+ return jjStartNfa_0(6, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(7, active0, active1);
@@ -889,7 +889,7 @@
private final int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(7, old0, old1);
+ return jjStartNfa_0(7, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(8, active0, active1);
@@ -925,7 +925,7 @@
private final int jjMoveStringLiteralDfa10_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(8, old0, old1);
+ return jjStartNfa_0(8, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(9, active0, active1);
@@ -969,7 +969,7 @@
private final int jjMoveStringLiteralDfa11_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(9, old0, old1);
+ return jjStartNfa_0(9, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(10, active0, active1);
@@ -1005,7 +1005,7 @@
private final int jjMoveStringLiteralDfa12_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(10, old0, old1);
+ return jjStartNfa_0(10, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(11, active0, active1);
@@ -1045,7 +1045,7 @@
private final int jjMoveStringLiteralDfa13_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(11, old0, old1);
+ return jjStartNfa_0(11, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(12, active0, active1);
@@ -1073,7 +1073,7 @@
private final int jjMoveStringLiteralDfa14_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(12, old0, old1);
+ return jjStartNfa_0(12, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(13, active0, active1);
@@ -1105,7 +1105,7 @@
private final int jjMoveStringLiteralDfa15_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_0(13, old0, old1);
+ return jjStartNfa_0(13, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(14, active0, 0L);
@@ -1585,7 +1585,7 @@
}
}
static final int[] jjnextStates = {
- 1, 2, 4, 5,
+ 1, 2, 4, 5,
};
private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
{
@@ -1593,7 +1593,7 @@
{
case 0:
return ((jjbitVec2[i2] & l2) != 0L);
- default :
+ default :
if ((jjbitVec0[i1] & l1) != 0L)
return true;
return false;
@@ -1649,7 +1649,7 @@
return ((jjbitVec25[i2] & l2) != 0L);
case 215:
return ((jjbitVec26[i2] & l2) != 0L);
- default :
+ default :
if ((jjbitVec3[i1] & l1) != 0L)
return true;
return false;
@@ -1707,42 +1707,42 @@
return ((jjbitVec25[i2] & l2) != 0L);
case 215:
return ((jjbitVec26[i2] & l2) != 0L);
- default :
+ default :
if ((jjbitVec3[i1] & l1) != 0L)
return true;
return false;
}
}
public static final String[] jjstrLiteralImages = {
-"", null, null, null, null, null, "\57", "\57\57", "\174", "\53", "\55",
-"\75", "\41\75", "\74", "\74\75", "\76", "\76\75", "\44", null, null, null, null,
-null, null, null, null, null, "\157\162", "\141\156\144", "\155\157\144",
-"\144\151\166", "\156\157\144\145", "\164\145\170\164", "\143\157\155\155\145\156\164",
-"\160\162\157\143\145\163\163\151\156\147\55\151\156\163\164\162\165\143\164\151\157\156", "\163\145\154\146\72\72", "\143\150\151\154\144\72\72",
-"\160\141\162\145\156\164\72\72", "\141\156\143\145\163\164\157\162\72\72",
-"\141\164\164\162\151\142\165\164\145\72\72", "\156\141\155\145\163\160\141\143\145\72\72",
-"\160\162\145\143\145\144\151\156\147\72\72", "\146\157\154\154\157\167\151\156\147\72\72",
-"\144\145\163\143\145\156\144\141\156\164\72\72", "\141\156\143\145\163\164\157\162\55\157\162\55\163\145\154\146\72\72",
-"\146\157\154\154\157\167\151\156\147\55\163\151\142\154\151\156\147\72\72", "\160\162\145\143\145\144\151\156\147\55\163\151\142\154\151\156\147\72\72",
-"\144\145\163\143\145\156\144\141\156\164\55\157\162\55\163\145\154\146\72\72", "\154\141\163\164", "\160\157\163\151\164\151\157\156",
-"\143\157\165\156\164", "\151\144", "\153\145\171", "\154\157\143\141\154\55\156\141\155\145",
-"\156\141\155\145\163\160\141\143\145\55\165\162\151", "\156\141\155\145", "\163\164\162\151\156\147", "\143\157\156\143\141\164",
-"\163\164\141\162\164\163\55\167\151\164\150", "\143\157\156\164\141\151\156\163",
-"\163\165\142\163\164\162\151\156\147\55\142\145\146\157\162\145", "\163\165\142\163\164\162\151\156\147\55\141\146\164\145\162",
-"\163\165\142\163\164\162\151\156\147", "\163\164\162\151\156\147\55\154\145\156\147\164\150",
-"\156\157\162\155\141\154\151\172\145\55\163\160\141\143\145", "\164\162\141\156\163\154\141\164\145", "\142\157\157\154\145\141\156",
-"\156\157\164", "\164\162\165\145", "\146\141\154\163\145", "\156\165\154\154",
-"\154\141\156\147", "\156\165\155\142\145\162", "\163\165\155", "\146\154\157\157\162",
-"\143\145\151\154\151\156\147", "\162\157\165\156\144", "\146\157\162\155\141\164\55\156\165\155\142\145\162",
+"", null, null, null, null, null, "\57", "\57\57", "\174", "\53", "\55",
+"\75", "\41\75", "\74", "\74\75", "\76", "\76\75", "\44", null, null, null, null,
+null, null, null, null, null, "\157\162", "\141\156\144", "\155\157\144",
+"\144\151\166", "\156\157\144\145", "\164\145\170\164", "\143\157\155\155\145\156\164",
+"\160\162\157\143\145\163\163\151\156\147\55\151\156\163\164\162\165\143\164\151\157\156", "\163\145\154\146\72\72", "\143\150\151\154\144\72\72",
+"\160\141\162\145\156\164\72\72", "\141\156\143\145\163\164\157\162\72\72",
+"\141\164\164\162\151\142\165\164\145\72\72", "\156\141\155\145\163\160\141\143\145\72\72",
+"\160\162\145\143\145\144\151\156\147\72\72", "\146\157\154\154\157\167\151\156\147\72\72",
+"\144\145\163\143\145\156\144\141\156\164\72\72", "\141\156\143\145\163\164\157\162\55\157\162\55\163\145\154\146\72\72",
+"\146\157\154\154\157\167\151\156\147\55\163\151\142\154\151\156\147\72\72", "\160\162\145\143\145\144\151\156\147\55\163\151\142\154\151\156\147\72\72",
+"\144\145\163\143\145\156\144\141\156\164\55\157\162\55\163\145\154\146\72\72", "\154\141\163\164", "\160\157\163\151\164\151\157\156",
+"\143\157\165\156\164", "\151\144", "\153\145\171", "\154\157\143\141\154\55\156\141\155\145",
+"\156\141\155\145\163\160\141\143\145\55\165\162\151", "\156\141\155\145", "\163\164\162\151\156\147", "\143\157\156\143\141\164",
+"\163\164\141\162\164\163\55\167\151\164\150", "\143\157\156\164\141\151\156\163",
+"\163\165\142\163\164\162\151\156\147\55\142\145\146\157\162\145", "\163\165\142\163\164\162\151\156\147\55\141\146\164\145\162",
+"\163\165\142\163\164\162\151\156\147", "\163\164\162\151\156\147\55\154\145\156\147\164\150",
+"\156\157\162\155\141\154\151\172\145\55\163\160\141\143\145", "\164\162\141\156\163\154\141\164\145", "\142\157\157\154\145\141\156",
+"\156\157\164", "\164\162\165\145", "\146\141\154\163\145", "\156\165\154\154",
+"\154\141\156\147", "\156\165\155\142\145\162", "\163\165\155", "\146\154\157\157\162",
+"\143\145\151\154\151\156\147", "\162\157\165\156\144", "\146\157\162\155\141\164\55\156\165\155\142\145\162",
null, "\72", "\50", "\51", "\56", "\56\56", "\133", "\135", "\100", "\54", "\52", };
public static final String[] lexStateNames = {
- "DEFAULT",
+ "DEFAULT",
};
static final long[] jjtoToken = {
- 0xfffffffff817ffc1L, 0x1ffffffL,
+ 0xfffffffff817ffc1L, 0x1ffffffL,
};
static final long[] jjtoSkip = {
- 0x3eL, 0x0L,
+ 0x3eL, 0x0L,
};
protected SimpleCharStream input_stream;
private final int[] jjrounds = new int[13];
@@ -1806,7 +1806,7 @@
int jjmatchedPos;
int jjmatchedKind;
-public Token getNextToken()
+public Token getNextToken()
{
int kind;
Token specialToken = null;
@@ -1815,13 +1815,13 @@
EOFLoop :
for (;;)
- {
- try
- {
+ {
+ try
+ {
curChar = input_stream.BeginToken();
- }
+ }
catch(java.io.IOException e)
- {
+ {
jjmatchedKind = 0;
matchedToken = jjFillToken();
return matchedToken;
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/HttpSessionHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/HttpSessionHandler.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/HttpSessionHandler.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/HttpSessionHandler.java Sun Dec 16 23:29:28 2007
@@ -33,7 +33,7 @@
public class HttpSessionHandler extends ServletContextHandler {
protected void collectPropertyNames(HashSet set, Object bean) {
- HttpSessionAndServletContext handle =
+ HttpSessionAndServletContext handle =
(HttpSessionAndServletContext) bean;
super.collectPropertyNames(set, handle.getServletContext());
HttpSession session = handle.getSession();
@@ -44,9 +44,9 @@
}
}
}
-
+
public Object getProperty(Object bean, String property) {
- HttpSessionAndServletContext handle =
+ HttpSessionAndServletContext handle =
(HttpSessionAndServletContext) bean;
HttpSession session = handle.getSession();
if (session != null) {
@@ -59,7 +59,7 @@
}
public void setProperty(Object bean, String property, Object value) {
- HttpSessionAndServletContext handle =
+ HttpSessionAndServletContext handle =
(HttpSessionAndServletContext) bean;
HttpSession session = handle.getSession();
if (session != null) {
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/JXPathServletContexts.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/JXPathServletContexts.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/JXPathServletContexts.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/JXPathServletContexts.java Sun Dec 16 23:29:28 2007
@@ -115,7 +115,7 @@
*/
public static JXPathContext getRequestContext(
ServletRequest request,
- ServletContext servletContext)
+ ServletContext servletContext)
{
JXPathContext context =
(JXPathContext) request.getAttribute(Constants.JXPATH_CONTEXT);
@@ -123,13 +123,13 @@
// will represent the included URL, but the JXPathContext we have
// just acquired will represent the outer request.
if (context != null) {
- ServletRequestAndContext handle =
+ ServletRequestAndContext handle =
(ServletRequestAndContext) context.getContextBean();
if (handle.getServletRequest() == request) {
return context;
}
}
-
+
JXPathContext parentContext = null;
if (request instanceof HttpServletRequest) {
HttpSession session =
@@ -141,7 +141,7 @@
parentContext = getApplicationContext(servletContext);
}
}
- ServletRequestAndContext handle =
+ ServletRequestAndContext handle =
new ServletRequestAndContext(request, servletContext);
context = factory.newContext(parentContext, handle);
context.setVariables(
@@ -156,13 +156,13 @@
*/
public static JXPathContext getSessionContext(
HttpSession session,
- ServletContext servletContext)
+ ServletContext servletContext)
{
JXPathContext context =
(JXPathContext) session.getAttribute(Constants.JXPATH_CONTEXT);
if (context == null) {
JXPathContext parentContext = getApplicationContext(servletContext);
- HttpSessionAndServletContext handle =
+ HttpSessionAndServletContext handle =
new HttpSessionAndServletContext(session, servletContext);
context = factory.newContext(parentContext, handle);
context.setVariables(
@@ -177,7 +177,7 @@
* context within the servlet context itself.
*/
public static JXPathContext getApplicationContext(
- ServletContext servletContext)
+ ServletContext servletContext)
{
JXPathContext context =
(JXPathContext) servletContext.getAttribute(
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/PageContextHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/PageContextHandler.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/PageContextHandler.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/PageContextHandler.java Sun Dec 16 23:29:28 2007
@@ -71,7 +71,7 @@
public void setProperty(
Object pageContext,
String property,
- Object value)
+ Object value)
{
((PageContext) pageContext).setAttribute(
property,
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/PageScopeContextHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/PageScopeContextHandler.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/PageScopeContextHandler.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/PageScopeContextHandler.java Sun Dec 16 23:29:28 2007
@@ -29,7 +29,7 @@
* @version $Revision$ $Date$
*/
public class PageScopeContextHandler implements DynamicPropertyHandler {
-
+
private static final String[] STRING_ARRAY = new String[0];
public String[] getPropertyNames(Object pageScope) {
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/ServletContextHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/ServletContextHandler.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/ServletContextHandler.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/ServletContextHandler.java Sun Dec 16 23:29:28 2007
@@ -31,7 +31,7 @@
* @version $Revision$ $Date$
*/
public class ServletContextHandler implements DynamicPropertyHandler {
-
+
private static final String[] STRING_ARRAY = new String[0];
public String[] getPropertyNames(Object context) {
@@ -39,7 +39,7 @@
collectPropertyNames(list, context);
return (String[]) list.toArray(STRING_ARRAY);
}
-
+
protected void collectPropertyNames(HashSet set, Object bean) {
Enumeration e = ((ServletContext) bean).getAttributeNames();
while (e.hasMoreElements()) {
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/ServletRequestAndContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/ServletRequestAndContext.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/ServletRequestAndContext.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/ServletRequestAndContext.java Sun Dec 16 23:29:28 2007
@@ -27,23 +27,32 @@
* @author Dmitri Plotnikov
* @version $Revision$ $Date$
*/
-public class ServletRequestAndContext extends
- HttpSessionAndServletContext
-{
+public class ServletRequestAndContext extends HttpSessionAndServletContext {
private ServletRequest request;
+ /**
+ * Create a new ServletRequestAndContext.
+ * @param request ServletRequest
+ * @param context ServletContext
+ */
public ServletRequestAndContext(ServletRequest request,
- ServletContext context)
- {
+ ServletContext context) {
super(null, context);
this.request = request;
}
+ /**
+ * {@inheritDoc}
+ */
public HttpSession getSession() {
return request instanceof HttpServletRequest
? ((HttpServletRequest) request).getSession(false) : null;
}
+ /**
+ * Get the request.
+ * @return ServletRequest
+ */
public ServletRequest getServletRequest() {
return request;
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/ServletRequestHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/ServletRequestHandler.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/ServletRequestHandler.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/servlet/ServletRequestHandler.java Sun Dec 16 23:29:28 2007
@@ -29,10 +29,10 @@
* @version $Revision$ $Date$
*/
public class ServletRequestHandler extends HttpSessionHandler {
-
+
protected void collectPropertyNames(HashSet set, Object bean) {
super.collectPropertyNames(set, bean);
- ServletRequestAndContext handle = (ServletRequestAndContext) bean;
+ ServletRequestAndContext handle = (ServletRequestAndContext) bean;
ServletRequest servletRequest = handle.getServletRequest();
Enumeration e = servletRequest.getAttributeNames();
while (e.hasMoreElements()) {
@@ -43,9 +43,9 @@
set.add(e.nextElement());
}
}
-
- public Object getProperty(Object bean, String property) {
- ServletRequestAndContext handle = (ServletRequestAndContext) bean;
+
+ public Object getProperty(Object bean, String property) {
+ ServletRequestAndContext handle = (ServletRequestAndContext) bean;
ServletRequest servletRequest = handle.getServletRequest();
String[] strings = servletRequest.getParameterValues(property);
if (strings != null) {
@@ -57,12 +57,12 @@
}
return strings;
}
-
+
Object object = servletRequest.getAttribute(property);
if (object != null) {
return object;
}
-
+
return super.getProperty(bean, property);
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/BasicTypeConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/BasicTypeConverter.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/BasicTypeConverter.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/BasicTypeConverter.java Sun Dec 16 23:29:28 2007
@@ -192,7 +192,7 @@
}
return unmodifiableCollection(collection);
}
- if (length > 0) {
+ if (length > 0) {
Object value = Array.get(object, 0);
return convert(value, useType);
}
@@ -331,7 +331,7 @@
}
return null;
}
-
+
protected Number allocateNumber(Class type, double value) {
type = TypeUtils.wrapPrimitive(type);
if (type == Byte.class) {
@@ -435,15 +435,15 @@
public ValueNodeSet(List values) {
this.values = values;
}
-
+
public List getValues() {
return Collections.unmodifiableList(values);
}
-
+
public List getNodes() {
return Collections.unmodifiableList(values);
}
-
+
public List getPointers() {
if (pointers == null) {
pointers = new ArrayList();
@@ -455,38 +455,38 @@
return pointers;
}
}
-
+
static final class ValuePointer implements Pointer {
private Object bean;
public ValuePointer(Object object) {
this.bean = object;
}
-
+
public Object getValue() {
return bean;
}
-
+
public Object getNode() {
return bean;
}
-
+
public Object getRootNode() {
return bean;
- }
-
+ }
+
public void setValue(Object value) {
throw new UnsupportedOperationException();
}
-
+
public Object clone() {
return this;
}
-
+
public int compareTo(Object object) {
return 0;
}
-
+
public String asPath() {
if (bean == null) {
return "null()";
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/MethodLookupUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/MethodLookupUtils.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/MethodLookupUtils.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/MethodLookupUtils.java Sun Dec 16 23:29:28 2007
@@ -37,13 +37,18 @@
private static final int APPROXIMATE_MATCH = 1;
private static final int EXACT_MATCH = 2;
+ /**
+ * Look up a constructor.
+ * @param targetClass the class constructed
+ * @param parameters arguments
+ * @return Constructor found if any.
+ */
public static Constructor lookupConstructor(
Class targetClass,
- Object[] parameters)
- {
+ Object[] parameters) {
boolean tryExact = true;
int count = parameters == null ? 0 : parameters.length;
- Class types[] = new Class[count];
+ Class[] types = new Class[count];
for (int i = 0; i < count; i++) {
Object param = parameters[i];
if (param != null) {
@@ -98,14 +103,20 @@
return constructor;
}
+ /**
+ * Look up a static method.
+ * @param targetClass the owning class
+ * @param name method name
+ * @param parameters method parameters
+ * @return Method found if any
+ */
public static Method lookupStaticMethod(
Class targetClass,
String name,
- Object[] parameters)
- {
+ Object[] parameters) {
boolean tryExact = true;
int count = parameters == null ? 0 : parameters.length;
- Class types[] = new Class[count];
+ Class[] types = new Class[count];
for (int i = 0; i < count; i++) {
Object param = parameters[i];
if (param != null) {
@@ -163,11 +174,17 @@
return method;
}
+ /**
+ * Look up a method.
+ * @param targetClass owning class
+ * @param name method name
+ * @param parameters method parameters
+ * @return Method found if any
+ */
public static Method lookupMethod(
Class targetClass,
String name,
- Object[] parameters)
- {
+ Object[] parameters) {
if (parameters == null
|| parameters.length < 1
|| parameters[0] == null) {
@@ -182,8 +199,8 @@
boolean tryExact = true;
int count = parameters.length - 1;
- Class types[] = new Class[count];
- Object arguments[] = new Object[count];
+ Class[] types = new Class[count];
+ Object[] arguments = new Object[count];
for (int i = 0; i < count; i++) {
Object param = parameters[i + 1];
arguments[i] = param;
@@ -242,10 +259,15 @@
return method;
}
+ /**
+ * Return a match code of objects to types.
+ * @param types Class[] of expected types
+ * @param parameters Object[] to attempt to match
+ * @return int code
+ */
private static int matchParameterTypes(
- Class types[],
- Object parameters[])
- {
+ Class[] types,
+ Object[] parameters) {
int pi = 0;
if (types.length >= 1
&& ExpressionContext.class.isAssignableFrom(types[0])) {
@@ -268,6 +290,12 @@
return totalMatch;
}
+ /**
+ * Return a match code between an object and type.
+ * @param expected class to test
+ * @param object object to test
+ * @return int code
+ */
private static int matchType(Class expected, Object object) {
if (object == null) {
return APPROXIMATE_MATCH;
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/TypeConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/TypeConverter.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/TypeConverter.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/TypeConverter.java Sun Dec 16 23:29:28 2007
@@ -31,6 +31,9 @@
/**
* Returns true if it can convert the supplied
* object to the specified class.
+ * @param object object to test
+ * @param toType target class
+ * @return boolean
*/
boolean canConvert(Object object, Class toType);
@@ -38,6 +41,9 @@
* Converts the supplied object to the specified
* type. Throws a runtime exception if the conversion is
* not possible.
+ * @param object object to convert
+ * @param toType target class
+ * @return resulting Object
*/
Object convert(Object object, Class toType);
}
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/TypeUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/TypeUtils.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/TypeUtils.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/TypeUtils.java Sun Dec 16 23:29:28 2007
@@ -41,6 +41,7 @@
/**
* Install an alternative type converter.
+ * @param converter new TypeConverter
*/
public static synchronized void setTypeConverter(TypeConverter converter) {
typeConverter = converter;
@@ -48,6 +49,7 @@
/**
* Returns the current type converter.
+ * @return TypeConverter
*/
public static TypeConverter getTypeConverter() {
return typeConverter;
@@ -56,6 +58,9 @@
/**
* Returns true if the global converter can convert the supplied
* object to the specified type.
+ * @param object object to test
+ * @param toType target class
+ * @return boolean
*/
public static boolean canConvert(Object object, Class toType) {
return typeConverter.canConvert(object, toType);
@@ -64,6 +69,9 @@
/**
* Converts the supplied object to the specified type. May
* throw a RuntimeException.
+ * @param object object to convert
+ * @param toType target class
+ * @return resulting Object
*/
public static Object convert(Object object, Class toType) {
return typeConverter.convert(object, toType);
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ValueUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ValueUtils.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ValueUtils.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/util/ValueUtils.java Sun Dec 16 23:29:28 2007
@@ -60,9 +60,9 @@
}
return false;
}
-
+
/**
- * Returns 1 if the type is a collection,
+ * Returns 1 if the type is a collection,
* -1 if it is definitely not
* and 0 if it may be a collection in some cases.
*/
@@ -70,42 +70,42 @@
if (clazz.isArray()) {
return 1;
}
-
+
if (Collection.class.isAssignableFrom(clazz)) {
return 1;
}
-
+
if (clazz.isPrimitive()) {
return -1;
}
-
+
if (clazz.isInterface()) {
return 0;
}
-
+
if (Modifier.isFinal(clazz.getModifiers())) {
return -1;
}
-
+
return 0;
}
-
+
/**
* If there is a regular non-indexed read method for this property,
* uses this method to obtain the collection and then returns its
* length.
* Otherwise, attempts to guess the length of the collection by
* calling the indexed get method repeatedly. The method is supposed
- * to throw an exception if the index is out of bounds.
+ * to throw an exception if the index is out of bounds.
*/
public static int getIndexedPropertyLength(
Object object,
- IndexedPropertyDescriptor pd)
+ IndexedPropertyDescriptor pd)
{
if (pd.getReadMethod() != null) {
return getLength(getValue(object, pd));
}
-
+
Method readMethod = pd.getIndexedReadMethod();
if (readMethod == null) {
throw new JXPathException(
@@ -120,7 +120,7 @@
return i;
}
}
-
+
throw new JXPathException(
"Cannot determine the length of the indexed property "
+ pd.getName());
@@ -326,7 +326,7 @@
*/
public static Object getValue(
Object bean,
- PropertyDescriptor propertyDescriptor)
+ PropertyDescriptor propertyDescriptor)
{
Object value;
try {
@@ -355,7 +355,7 @@
public static void setValue(
Object bean,
PropertyDescriptor propertyDescriptor,
- Object value)
+ Object value)
{
try {
Method method =
@@ -397,7 +397,7 @@
public static Object getValue(
Object bean,
PropertyDescriptor propertyDescriptor,
- int index)
+ int index)
{
if (propertyDescriptor instanceof IndexedPropertyDescriptor) {
try {
@@ -409,7 +409,7 @@
bean,
new Object[] { new Integer(index)});
}
- }
+ }
catch (InvocationTargetException ex) {
Throwable t = ex.getTargetException();
if (t instanceof IndexOutOfBoundsException) {
@@ -440,7 +440,7 @@
Object bean,
PropertyDescriptor propertyDescriptor,
int index,
- Object value)
+ Object value)
{
if (propertyDescriptor instanceof IndexedPropertyDescriptor) {
try {
@@ -488,12 +488,12 @@
}
return object;
}
-
+
/**
* Returns a shared instance of the dynamic property handler class
* returned by <code>getDynamicPropertyHandlerClass()</code>.
*/
- public static DynamicPropertyHandler getDynamicPropertyHandler(Class clazz)
+ public static DynamicPropertyHandler getDynamicPropertyHandler(Class clazz)
{
DynamicPropertyHandler handler =
(DynamicPropertyHandler) dynamicPropertyHandlerMap.get(clazz);
@@ -548,17 +548,17 @@
Class[] parameterTypes = method.getParameterTypes();
while (clazz != null) {
// Check the implemented interfaces and subinterfaces
- Method aMethod = getAccessibleMethodFromInterfaceNest(clazz,
+ Method aMethod = getAccessibleMethodFromInterfaceNest(clazz,
name, parameterTypes);
if (aMethod != null) {
return aMethod;
}
-
+
clazz = clazz.getSuperclass();
if (clazz != null && Modifier.isPublic(clazz.getModifiers())) {
try {
return clazz.getDeclaredMethod(name, parameterTypes);
- }
+ }
catch (NoSuchMethodException e) {
;
}
@@ -581,7 +581,7 @@
private static Method getAccessibleMethodFromInterfaceNest(
Class clazz,
String methodName,
- Class parameterTypes[])
+ Class parameterTypes[])
{
Method method = null;
@@ -606,7 +606,7 @@
if (method != null) {
break;
}
-
+
// Recursively check our parent interfaces
method =
getAccessibleMethodFromInterfaceNest(
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/DOMParser.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/DOMParser.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/DOMParser.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/DOMParser.java Sun Dec 16 23:29:28 2007
@@ -30,11 +30,14 @@
*/
public class DOMParser extends XMLParser2 {
+ /**
+ * {@inheritDoc}
+ */
public Object parseXML(InputStream stream) {
try {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
-
+
factory.setValidating(isValidating());
factory.setNamespaceAware(isNamespaceAware());
factory.setIgnoringElementContentWhitespace(
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/DocumentContainer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/DocumentContainer.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/DocumentContainer.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/DocumentContainer.java Sun Dec 16 23:29:28 2007
@@ -38,7 +38,10 @@
*/
public class DocumentContainer extends XMLParser2 implements Container {
+ /** DOM constant */
public static final String MODEL_DOM = "DOM";
+
+ /** JDOM constant */
public static final String MODEL_JDOM = "JDOM";
private Object document;
@@ -58,15 +61,19 @@
/**
* Add an XML parser. Parsers for the models "DOM" and "JDOM" are
* pre-registered.
+ * @param model model name
+ * @param parser parser
*/
public static void registerXMLParser(String model, XMLParser parser) {
parsers.put(model, parser);
}
/**
- * Add a class of a custom XML parser.
+ * Add a class of a custom XML parser.
* Parsers for the models "DOM" and "JDOM" are pre-registered.
- */
+ * @param model model name
+ * @param parserClassName parser classname
+ */
public static void registerXMLParser(String model, String parserClassName) {
parserClasses.put(model, parserClassName);
}
@@ -83,11 +90,12 @@
}
/**
+ * Construct a new DocumentContainer.
* @param xmlURL is a URL for an XML file. Use getClass().getResource
- * (resourceName) to load XML from a resource file.
+ * (resourceName) to load XML from a resource file.
*
* @param model is one of the MODEL_* constants defined in this class. It
- * determines which parser should be used to load the XML.
+ * determines which parser should be used to load the XML.
*/
public DocumentContainer(URL xmlURL, String model) {
this.xmlURL = xmlURL;
@@ -99,6 +107,7 @@
/**
* Reads XML, caches it internally and returns the Document.
+ * @return Object
*/
public Object getValue() {
if (document == null) {
@@ -127,6 +136,8 @@
/**
* Parses XML using the parser for the specified model.
+ * @param stream InputStream
+ * @return Object
*/
public Object parseXML(InputStream stream) {
XMLParser parser = getParser(model);
@@ -144,7 +155,8 @@
}
/**
- * Throws an UnsupportedOperationException
+ * Throws an UnsupportedOperationException.
+ * @param value value (not) to set
*/
public void setValue(Object value) {
throw new UnsupportedOperationException();
@@ -152,8 +164,10 @@
/**
* Maps a model type to a parser.
+ * @param model input model type
+ * @return XMLParser
*/
- private static final XMLParser getParser(String model) {
+ private static XMLParser getParser(String model) {
XMLParser parser = (XMLParser) parsers.get(model);
if (parser == null) {
String className = (String) parserClasses.get(model);
@@ -162,7 +176,7 @@
}
try {
Class clazz = Class.forName(className);
- parser = (XMLParser) clazz.newInstance();
+ parser = (XMLParser) clazz.newInstance();
}
catch (Exception ex) {
throw new JXPathException(
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/JDOMParser.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/JDOMParser.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/JDOMParser.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/JDOMParser.java Sun Dec 16 23:29:28 2007
@@ -28,13 +28,13 @@
* @version $Revision$ $Date$
*/
public class JDOMParser extends XMLParser2 {
-
+
public Object parseXML(InputStream stream) {
if (!isNamespaceAware()) {
throw new JXPathException("JDOM parser configuration error. JDOM "
+ "does not support the namespaceAware=false setting.");
}
-
+
try {
SAXBuilder builder = new SAXBuilder();
builder.setExpandEntities(isExpandEntityReferences());
Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/XMLParser2.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/XMLParser2.java?rev=604783&r1=604782&r2=604783&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/XMLParser2.java (original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/xml/XMLParser2.java Sun Dec 16 23:29:28 2007
@@ -25,7 +25,7 @@
* @author Dmitri Plotnikov
* @version $Revision$ $Date$
*/
-public abstract class XMLParser2 implements XMLParser
+public abstract class XMLParser2 implements XMLParser
{
private boolean validating = false;
private boolean namespaceAware = true;
@@ -33,90 +33,90 @@
private boolean expandEntityRef = true;
private boolean ignoreComments = false;
private boolean coalescing = false;
-
+
/**
* @see DocumentBuilderFactory#setValidating(boolean)
*/
public void setValidating(boolean validating) {
this.validating = validating;
}
-
+
/**
* @see DocumentBuilderFactory#isValidating()
*/
public boolean isValidating() {
return validating;
}
-
+
/**
* @see DocumentBuilderFactory#isNamespaceAware()
*/
public boolean isNamespaceAware() {
return namespaceAware;
}
-
+
/**
* @see DocumentBuilderFactory#setNamespaceAware(boolean)
*/
public void setNamespaceAware(boolean namespaceAware) {
this.namespaceAware = namespaceAware;
}
-
+
/**
* @see DocumentBuilderFactory#setIgnoringElementContentWhitespace(boolean)
*/
public void setIgnoringElementContentWhitespace(boolean whitespace) {
this.whitespace = whitespace;
}
-
+
/**
* @see DocumentBuilderFactory#isIgnoringElementContentWhitespace()
*/
public boolean isIgnoringElementContentWhitespace() {
return whitespace;
}
-
+
/**
* @see DocumentBuilderFactory#isExpandEntityReferences()
*/
public boolean isExpandEntityReferences() {
return expandEntityRef;
}
-
+
/**
* @see DocumentBuilderFactory#setExpandEntityReferences(boolean)
*/
public void setExpandEntityReferences(boolean expandEntityRef) {
this.expandEntityRef = expandEntityRef;
}
-
+
/**
* @see DocumentBuilderFactory#isIgnoringComments()
*/
public boolean isIgnoringComments() {
return ignoreComments;
}
-
+
/**
* @see DocumentBuilderFactory#setIgnoringComments(boolean)
*/
public void setIgnoringComments(boolean ignoreComments) {
this.ignoreComments = ignoreComments;
}
-
+
/**
* @see DocumentBuilderFactory#isCoalescing()
*/
public boolean isCoalescing() {
return coalescing;
}
-
+
/**
* @see DocumentBuilderFactory#setCoalescing(boolean)
*/
public void setCoalescing(boolean coalescing) {
this.coalescing = coalescing;
}
-
+
public abstract Object parseXML(InputStream stream);
}