You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by cb...@apache.org on 2009/01/23 07:32:46 UTC
svn commit: r736963 [6/21] - in /ibatis/trunk/java/ibatis-3:
ibatis-3-compat/src/main/java/com/ibatis/common/jdbc/
ibatis-3-compat/src/main/java/com/ibatis/common/resources/
ibatis-3-compat/src/main/java/com/ibatis/common/util/
ibatis-3-compat/src/main...
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/EvaluationPool.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/EvaluationPool.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/EvaluationPool.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/EvaluationPool.java Thu Jan 22 22:32:36 2009
@@ -30,131 +30,120 @@
//--------------------------------------------------------------------------
package org.apache.ibatis.ognl;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
-public final class EvaluationPool extends Object
-{
- private List evaluations = new ArrayList();
- private int size = 0;
- private int created = 0;
- private int recovered = 0;
- private int recycled = 0;
-
- public EvaluationPool()
- {
- this(0);
- }
-
- public EvaluationPool(int initialSize)
- {
- super();
- for (int i = 0; i < initialSize; i++) {
- evaluations.add(new Evaluation(null, null));
- }
- created = size = initialSize;
- }
-
- /**
- Returns an Evaluation that contains the node, source and whether it
- is a set operation. If there are no Evaluation objects in the
- pool one is created and returned.
- */
- public Evaluation create(SimpleNode node, Object source)
- {
- return create(node, source, false);
- }
-
- /**
- Returns an Evaluation that contains the node, source and whether it
- is a set operation. If there are no Evaluation objects in the
- pool one is created and returned.
- */
- public synchronized Evaluation create(SimpleNode node, Object source, boolean setOperation)
- {
- Evaluation result;
-
- if (size > 0) {
- result = (Evaluation)evaluations.remove(size - 1);
- result.init(node, source, setOperation);
- size--;
- recovered++;
- } else {
- result = new Evaluation(node, source, setOperation);
- created++;
- }
- return result;
- }
-
- /**
- Recycles an Evaluation
- */
- public synchronized void recycle(Evaluation value)
- {
- if (value != null) {
- value.reset();
- evaluations.add(value);
- size++;
- recycled++;
- }
- }
-
- /**
- Recycles an of Evaluation and all of it's siblings
- and children.
- */
- public void recycleAll(Evaluation value)
- {
- if (value != null) {
- recycleAll(value.getNext());
- recycleAll(value.getFirstChild());
- recycle(value);
- }
- }
-
- /**
- Recycles a List of Evaluation objects
- */
- public void recycleAll(List value)
- {
- if (value != null) {
- for (int i = 0, icount = value.size(); i < icount; i++) {
- recycle((Evaluation)value.get(i));
- }
- }
- }
-
- /**
- Returns the number of items in the pool
- */
- public int getSize()
- {
- return size;
- }
-
- /**
- Returns the number of items this pool has created since
- it's construction.
- */
- public int getCreatedCount()
- {
- return created;
- }
-
- /**
- Returns the number of items this pool has recovered from
- the pool since its construction.
- */
- public int getRecoveredCount()
- {
- return recovered;
- }
-
- /**
- Returns the number of items this pool has recycled since
- it's construction.
- */
- public int getRecycledCount()
- {
- return recycled;
- }
+public final class EvaluationPool extends Object {
+ private List evaluations = new ArrayList();
+ private int size = 0;
+ private int created = 0;
+ private int recovered = 0;
+ private int recycled = 0;
+
+ public EvaluationPool() {
+ this(0);
+ }
+
+ public EvaluationPool(int initialSize) {
+ super();
+ for (int i = 0; i < initialSize; i++) {
+ evaluations.add(new Evaluation(null, null));
+ }
+ created = size = initialSize;
+ }
+
+ /**
+ * Returns an Evaluation that contains the node, source and whether it
+ * is a set operation. If there are no Evaluation objects in the
+ * pool one is created and returned.
+ */
+ public Evaluation create(SimpleNode node, Object source) {
+ return create(node, source, false);
+ }
+
+ /**
+ * Returns an Evaluation that contains the node, source and whether it
+ * is a set operation. If there are no Evaluation objects in the
+ * pool one is created and returned.
+ */
+ public synchronized Evaluation create(SimpleNode node, Object source, boolean setOperation) {
+ Evaluation result;
+
+ if (size > 0) {
+ result = (Evaluation) evaluations.remove(size - 1);
+ result.init(node, source, setOperation);
+ size--;
+ recovered++;
+ } else {
+ result = new Evaluation(node, source, setOperation);
+ created++;
+ }
+ return result;
+ }
+
+ /**
+ * Recycles an Evaluation
+ */
+ public synchronized void recycle(Evaluation value) {
+ if (value != null) {
+ value.reset();
+ evaluations.add(value);
+ size++;
+ recycled++;
+ }
+ }
+
+ /**
+ * Recycles an of Evaluation and all of it's siblings
+ * and children.
+ */
+ public void recycleAll(Evaluation value) {
+ if (value != null) {
+ recycleAll(value.getNext());
+ recycleAll(value.getFirstChild());
+ recycle(value);
+ }
+ }
+
+ /**
+ * Recycles a List of Evaluation objects
+ */
+ public void recycleAll(List value) {
+ if (value != null) {
+ for (int i = 0, icount = value.size(); i < icount; i++) {
+ recycle((Evaluation) value.get(i));
+ }
+ }
+ }
+
+ /**
+ * Returns the number of items in the pool
+ */
+ public int getSize() {
+ return size;
+ }
+
+ /**
+ * Returns the number of items this pool has created since
+ * it's construction.
+ */
+ public int getCreatedCount() {
+ return created;
+ }
+
+ /**
+ * Returns the number of items this pool has recovered from
+ * the pool since its construction.
+ */
+ public int getRecoveredCount() {
+ return recovered;
+ }
+
+ /**
+ * Returns the number of items this pool has recycled since
+ * it's construction.
+ */
+ public int getRecycledCount() {
+ return recycled;
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/ExpressionNode.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/ExpressionNode.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/ExpressionNode.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/ExpressionNode.java Thu Jan 22 22:32:36 2009
@@ -34,61 +34,57 @@
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public abstract class ExpressionNode extends SimpleNode
-{
- public ExpressionNode(int i) {
- super(i);
- }
-
- public ExpressionNode(OgnlParser p, int i) {
- super(p, i);
- }
- /**
- Returns true iff this node is constant without respect to the children.
- */
- public boolean isNodeConstant( OgnlContext context ) throws OgnlException
- {
- return false;
- }
-
- public boolean isConstant( OgnlContext context ) throws OgnlException
- {
- boolean result = isNodeConstant(context);
-
- if ((children != null) && (children.length > 0)) {
- result = true;
- for ( int i=0; result && (i < children.length); ++i ) {
- if (children[i] instanceof SimpleNode) {
- result = ((SimpleNode)children[i]).isConstant( context );
- } else {
- result = false;
- }
- }
+public abstract class ExpressionNode extends SimpleNode {
+ public ExpressionNode(int i) {
+ super(i);
+ }
+
+ public ExpressionNode(OgnlParser p, int i) {
+ super(p, i);
+ }
+
+ /**
+ * Returns true iff this node is constant without respect to the children.
+ */
+ public boolean isNodeConstant(OgnlContext context) throws OgnlException {
+ return false;
+ }
+
+ public boolean isConstant(OgnlContext context) throws OgnlException {
+ boolean result = isNodeConstant(context);
+
+ if ((children != null) && (children.length > 0)) {
+ result = true;
+ for (int i = 0; result && (i < children.length); ++i) {
+ if (children[i] instanceof SimpleNode) {
+ result = ((SimpleNode) children[i]).isConstant(context);
+ } else {
+ result = false;
}
- return result;
+ }
}
+ return result;
+ }
- public String getExpressionOperator(int index)
- {
- throw new RuntimeException("unknown operator for " + OgnlParserTreeConstants.jjtNodeName[id]);
- }
-
- public String toString()
- {
- String result;
-
- result = (parent == null) ? "" : "(";
- if ((children != null) && (children.length > 0)) {
- for ( int i = 0; i < children.length; ++i ) {
- if (i > 0) {
- result += " " + getExpressionOperator(i) + " ";
- }
- result += children[i].toString();
- }
+ public String getExpressionOperator(int index) {
+ throw new RuntimeException("unknown operator for " + OgnlParserTreeConstants.jjtNodeName[id]);
+ }
+
+ public String toString() {
+ String result;
+
+ result = (parent == null) ? "" : "(";
+ if ((children != null) && (children.length > 0)) {
+ for (int i = 0; i < children.length; ++i) {
+ if (i > 0) {
+ result += " " + getExpressionOperator(i) + " ";
}
- if (parent != null) {
- result = result + ")";
- }
- return result;
+ result += children[i].toString();
+ }
+ }
+ if (parent != null) {
+ result = result + ")";
}
+ return result;
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/ExpressionSyntaxException.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/ExpressionSyntaxException.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/ExpressionSyntaxException.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/ExpressionSyntaxException.java Thu Jan 22 22:32:36 2009
@@ -33,13 +33,12 @@
/**
* Exception thrown if a malformed OGNL expression is encountered.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class ExpressionSyntaxException extends OgnlException
-{
- public ExpressionSyntaxException( String expression, Throwable reason )
- {
- super( "Malformed OGNL expression: " + expression, reason );
- }
+public class ExpressionSyntaxException extends OgnlException {
+ public ExpressionSyntaxException(String expression, Throwable reason) {
+ super("Malformed OGNL expression: " + expression, reason);
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/InappropriateExpressionException.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/InappropriateExpressionException.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/InappropriateExpressionException.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/InappropriateExpressionException.java Thu Jan 22 22:32:36 2009
@@ -35,13 +35,12 @@
* Exception thrown if an OGNL expression is evaluated in the wrong context; the usual
* case is when an expression that does not end in a property reference is passed to
* <code>setValue</code>.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class InappropriateExpressionException extends OgnlException
-{
- public InappropriateExpressionException( Node tree )
- {
- super( "Inappropriate OGNL expression: " + tree );
- }
+public class InappropriateExpressionException extends OgnlException {
+ public InappropriateExpressionException(Node tree) {
+ super("Inappropriate OGNL expression: " + tree);
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IntHashMap.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IntHashMap.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IntHashMap.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IntHashMap.java Thu Jan 22 22:32:36 2009
@@ -39,317 +39,290 @@
* <p>For non-Map access (faster) use the put(int, Object) method.</p>
* <p>This class implements Map for convenience, but this is not the most
* efficient usage.</p>
+ *
* @see java.util.HashMap
* @see java.util.Map
-*/
-public class IntHashMap extends Object implements Map
-{
- private Entry table[];
- private int count;
- private int threshold;
- private float loadFactor;
-
- /*===================================================================
- Private static classes
- ===================================================================*/
- private static class IntHashMapIterator implements Iterator
- {
- boolean keys;
- int index;
- Entry table[];
- Entry entry;
-
- IntHashMapIterator(Entry table[], boolean keys)
- {
- super();
- this.table = table;
- this.keys = keys;
- this.index = table.length;
- }
-
- /*===================================================================
- Iterator interface
- ===================================================================*/
- public boolean hasNext()
- {
- if (entry != null) {
- return true;
- }
- while (index-- > 0) {
- if ((entry = table[index]) != null) {
- return true;
- }
- }
- return false;
- }
-
- public Object next()
- {
- if (entry == null) {
- while ((index-- > 0) && ((entry = table[index]) == null)) {
- /* do nothing */
- }
- }
- if (entry != null) {
- Entry e = entry;
-
- entry = e.next;
- return keys ? new Integer(e.key) : e.value;
- }
- throw new NoSuchElementException("IntHashMapIterator");
- }
-
- public void remove()
- {
- throw new UnsupportedOperationException("remove");
- }
+ */
+public class IntHashMap extends Object implements Map {
+ private Entry table[];
+ private int count;
+ private int threshold;
+ private float loadFactor;
+
+ /*===================================================================
+ Private static classes
+ ===================================================================*/
+ private static class IntHashMapIterator implements Iterator {
+ boolean keys;
+ int index;
+ Entry table[];
+ Entry entry;
+
+ IntHashMapIterator(Entry table[], boolean keys) {
+ super();
+ this.table = table;
+ this.keys = keys;
+ this.index = table.length;
}
/*===================================================================
- Public static classes
- ===================================================================*/
- public static class Entry extends Object
- {
- int hash;
- int key;
- Object value;
- Entry next;
-
- public Entry()
- {
- super();
- }
- }
+ Iterator interface
+ ===================================================================*/
+ public boolean hasNext() {
+ if (entry != null) {
+ return true;
+ }
+ while (index-- > 0) {
+ if ((entry = table[index]) != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Object next() {
+ if (entry == null) {
+ while ((index-- > 0) && ((entry = table[index]) == null)) {
+ /* do nothing */
+ }
+ }
+ if (entry != null) {
+ Entry e = entry;
+
+ entry = e.next;
+ return keys ? new Integer(e.key) : e.value;
+ }
+ throw new NoSuchElementException("IntHashMapIterator");
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("remove");
+ }
+ }
+
+ /*===================================================================
+ Public static classes
+ ===================================================================*/
+ public static class Entry extends Object {
+ int hash;
+ int key;
+ Object value;
+ Entry next;
+
+ public Entry() {
+ super();
+ }
+ }
+
+ /*===================================================================
+ Constructors
+ ===================================================================*/
+ public IntHashMap(int initialCapacity, float loadFactor) {
+ super();
+ if (initialCapacity <= 0 || loadFactor <= 0.0) {
+ throw new IllegalArgumentException();
+ }
+ this.loadFactor = loadFactor;
+ table = new Entry[initialCapacity];
+ threshold = (int) (initialCapacity * loadFactor);
+ }
+
+ public IntHashMap(int initialCapacity) {
+ this(initialCapacity, 0.75f);
+ }
+
+ public IntHashMap() {
+ this(101, 0.75f);
+ }
+
+ /*===================================================================
+ Protected methods
+ ===================================================================*/
+ protected void rehash() {
+ int oldCapacity = table.length;
+ Entry oldTable[] = table;
+ int newCapacity = oldCapacity * 2 + 1;
+ Entry newTable[] = new Entry[newCapacity];
+
+ threshold = (int) (newCapacity * loadFactor);
+ table = newTable;
+ for (int i = oldCapacity; i-- > 0;) {
+ for (Entry old = oldTable[i]; old != null;) {
+ Entry e = old;
+ int index = (e.hash & 0x7FFFFFFF) % newCapacity;
+
+ old = old.next;
+ e.next = newTable[index];
+ newTable[index] = e;
+ }
+ }
+ }
+
+ /*===================================================================
+ Public methods
+ ===================================================================*/
+ public final boolean containsKey(int key) {
+ int index = (key & 0x7FFFFFFF) % table.length;
+
+ for (Entry e = table[index]; e != null; e = e.next) {
+ if ((e.hash == key) && (e.key == key)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public final Object get(int key) {
+ int index = (key & 0x7FFFFFFF) % table.length;
+
+ for (Entry e = table[index]; e != null; e = e.next) {
+ if ((e.hash == key) && (e.key == key)) {
+ return e.value;
+ }
+ }
+ return null;
+ }
+
+ public final Object put(int key, Object value) {
+ int index = (key & 0x7FFFFFFF) % table.length;
+
+ if (value == null) {
+ throw new IllegalArgumentException();
+ }
+ for (Entry e = table[index]; e != null; e = e.next) {
+ if ((e.hash == key) && (e.key == key)) {
+ Object old = e.value;
- /*===================================================================
- Constructors
- ===================================================================*/
- public IntHashMap(int initialCapacity, float loadFactor)
- {
- super();
- if (initialCapacity <= 0 || loadFactor <= 0.0) {
- throw new IllegalArgumentException();
- }
- this.loadFactor = loadFactor;
- table = new Entry[initialCapacity];
- threshold = (int)(initialCapacity * loadFactor);
+ e.value = value;
+ return old;
+ }
}
- public IntHashMap(int initialCapacity)
- {
- this(initialCapacity, 0.75f);
+ if (count >= threshold) {
+ // Rehash the table if the threshold is exceeded.
+ rehash();
+ return put(key, value);
}
- public IntHashMap()
- {
- this(101, 0.75f);
- }
+ Entry e = new Entry();
- /*===================================================================
- Protected methods
- ===================================================================*/
- protected void rehash()
- {
- int oldCapacity = table.length;
- Entry oldTable[] = table;
- int newCapacity = oldCapacity * 2 + 1;
- Entry newTable[] = new Entry[newCapacity];
-
- threshold = (int)(newCapacity * loadFactor);
- table = newTable;
- for (int i = oldCapacity ; i-- > 0 ;) {
- for (Entry old = oldTable[i] ; old != null;) {
- Entry e = old;
- int index = ( e.hash & 0x7FFFFFFF ) % newCapacity;
-
- old = old.next;
- e.next = newTable[index];
- newTable[index] = e;
- }
- }
- }
+ e.hash = key;
+ e.key = key;
+ e.value = value;
+ e.next = table[index];
+ table[index] = e;
+ ++count;
+ return null;
+ }
- /*===================================================================
- Public methods
- ===================================================================*/
- public final boolean containsKey(int key)
- {
- int index = (key & 0x7FFFFFFF) % table.length;
-
- for (Entry e = table[index] ; e != null ; e = e.next) {
- if ((e.hash == key) && (e.key == key)) {
- return true;
- }
- }
- return false;
- }
+ public final Object remove(int key) {
+ int index = (key & 0x7FFFFFFF) % table.length;
- public final Object get(int key)
- {
- int index = (key & 0x7FFFFFFF) % table.length;
-
- for (Entry e = table[index] ; e != null ; e = e.next) {
- if ((e.hash == key) && (e.key == key)) {
- return e.value;
- }
+ for (Entry e = table[index], prev = null; e != null; prev = e, e = e.next) {
+ if ((e.hash == key) && (e.key == key)) {
+ if (prev != null) {
+ prev.next = e.next;
+ } else {
+ table[index] = e.next;
}
- return null;
+ --count;
+ return e.value;
+ }
}
+ return null;
+ }
- public final Object put(int key, Object value)
- {
- int index = ( key & 0x7FFFFFFF ) % table.length;
+ /*===================================================================
+ Map interface
+ ===================================================================*/
+ public int size() {
+ return count;
+ }
- if (value == null) {
- throw new IllegalArgumentException();
- }
- for (Entry e = table[index] ; e != null ; e = e.next) {
- if ((e.hash == key) && (e.key == key)) {
- Object old = e.value;
-
- e.value = value;
- return old;
- }
- }
+ public boolean isEmpty() {
+ return count == 0;
+ }
- if (count >= threshold) {
- // Rehash the table if the threshold is exceeded.
- rehash();
- return put(key, value);
- }
-
- Entry e = new Entry();
-
- e.hash = key;
- e.key = key;
- e.value = value;
- e.next = table[index];
- table[index] = e;
- ++count;
- return null;
- }
-
- public final Object remove(int key)
- {
- int index = (key & 0x7FFFFFFF) % table.length;
-
- for (Entry e = table[index], prev = null ; e != null ; prev = e, e = e.next) {
- if ((e.hash == key) && (e.key == key)) {
- if ( prev != null ) {
- prev.next = e.next;
- } else {
- table[index] = e.next;
- }
- --count;
- return e.value;
- }
- }
- return null;
+ public Object get(Object key) {
+ if (!(key instanceof Number)) {
+ throw new IllegalArgumentException("key is not an Number subclass");
}
+ return get(((Number) key).intValue());
+ }
- /*===================================================================
- Map interface
- ===================================================================*/
- public int size()
- {
- return count;
- }
-
- public boolean isEmpty()
- {
- return count == 0;
- }
-
- public Object get(Object key)
- {
- if (!(key instanceof Number)) {
- throw new IllegalArgumentException("key is not an Number subclass");
- }
- return get(((Number)key).intValue());
- }
-
- public Object put(Object key, Object value)
- {
- if (!(key instanceof Number)) {
- throw new IllegalArgumentException( "key cannot be null" );
- }
- return put(((Number)key).intValue(), value );
+ public Object put(Object key, Object value) {
+ if (!(key instanceof Number)) {
+ throw new IllegalArgumentException("key cannot be null");
}
+ return put(((Number) key).intValue(), value);
+ }
- public void putAll(Map otherMap)
- {
- for (Iterator it = otherMap.keySet().iterator(); it.hasNext();) {
- Object k = it.next();
+ public void putAll(Map otherMap) {
+ for (Iterator it = otherMap.keySet().iterator(); it.hasNext();) {
+ Object k = it.next();
- put(k, otherMap.get(k));
- }
+ put(k, otherMap.get(k));
}
+ }
- public Object remove(Object key)
- {
- if (!(key instanceof Number)) {
- throw new IllegalArgumentException("key cannot be null");
- }
- return remove(((Number)key).intValue());
- }
+ public Object remove(Object key) {
+ if (!(key instanceof Number)) {
+ throw new IllegalArgumentException("key cannot be null");
+ }
+ return remove(((Number) key).intValue());
+ }
- public void clear()
- {
- Entry tab[] = table;
+ public void clear() {
+ Entry tab[] = table;
- for (int index = tab.length; --index >= 0;) {
- tab[index] = null;
- }
- count = 0;
- }
+ for (int index = tab.length; --index >= 0;) {
+ tab[index] = null;
+ }
+ count = 0;
+ }
- public boolean containsKey(Object key)
- {
- if (!(key instanceof Number)) {
- throw new InternalError( "key is not an Number subclass" );
- }
- return containsKey(((Number)key).intValue());
- }
+ public boolean containsKey(Object key) {
+ if (!(key instanceof Number)) {
+ throw new InternalError("key is not an Number subclass");
+ }
+ return containsKey(((Number) key).intValue());
+ }
- public boolean containsValue(Object value)
- {
- Entry tab[] = table;
+ public boolean containsValue(Object value) {
+ Entry tab[] = table;
- if (value == null) {
- throw new IllegalArgumentException();
- }
- for (int i = tab.length ; i-- > 0;) {
- for (Entry e = tab[i] ; e != null ; e = e.next ) {
- if (e.value.equals(value)) {
- return true;
- }
- }
+ if (value == null) {
+ throw new IllegalArgumentException();
+ }
+ for (int i = tab.length; i-- > 0;) {
+ for (Entry e = tab[i]; e != null; e = e.next) {
+ if (e.value.equals(value)) {
+ return true;
}
- return false;
+ }
}
+ return false;
+ }
- public Set keySet()
- {
- Set result = new HashSet();
+ public Set keySet() {
+ Set result = new HashSet();
- for (Iterator it = new IntHashMapIterator(table, true); it.hasNext();) {
- result.add(it.next());
- }
- return result;
+ for (Iterator it = new IntHashMapIterator(table, true); it.hasNext();) {
+ result.add(it.next());
}
+ return result;
+ }
- public Collection values()
- {
- List result = new ArrayList();
+ public Collection values() {
+ List result = new ArrayList();
- for (Iterator it = new IntHashMapIterator(table, false); it.hasNext();) {
- result.add(it.next());
- }
- return result;
+ for (Iterator it = new IntHashMapIterator(table, false); it.hasNext();) {
+ result.add(it.next());
}
+ return result;
+ }
- public Set entrySet()
- {
- throw new UnsupportedOperationException("entrySet");
- }
+ public Set entrySet() {
+ throw new UnsupportedOperationException("entrySet");
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IteratorElementsAccessor.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IteratorElementsAccessor.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IteratorElementsAccessor.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IteratorElementsAccessor.java Thu Jan 22 22:32:36 2009
@@ -30,18 +30,18 @@
//--------------------------------------------------------------------------
package org.apache.ibatis.ognl;
-import java.util.*;
+import java.util.Enumeration;
+import java.util.Iterator;
/**
* Implementation of the ElementsAccessor interface for Iterators, which simply returns
* the target iterator itself.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class IteratorElementsAccessor implements ElementsAccessor
-{
- public Enumeration getElements( Object target )
- {
- return new IteratorEnumeration( (Iterator)target );
- }
+public class IteratorElementsAccessor implements ElementsAccessor {
+ public Enumeration getElements(Object target) {
+ return new IteratorEnumeration((Iterator) target);
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IteratorEnumeration.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IteratorEnumeration.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IteratorEnumeration.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IteratorEnumeration.java Thu Jan 22 22:32:36 2009
@@ -30,28 +30,28 @@
//--------------------------------------------------------------------------
package org.apache.ibatis.ognl;
-import java.util.*;
+import java.util.Enumeration;
+import java.util.Iterator;
/**
* Maps an Iterator to an Enumeration
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class IteratorEnumeration extends Object implements Enumeration
-{
- private Iterator it;
+public class IteratorEnumeration extends Object implements Enumeration {
+ private Iterator it;
- public IteratorEnumeration(Iterator it)
- {
- super();
- this.it = it;
- }
+ public IteratorEnumeration(Iterator it) {
+ super();
+ this.it = it;
+ }
- public boolean hasMoreElements() {
- return it.hasNext();
- }
+ public boolean hasMoreElements() {
+ return it.hasNext();
+ }
- public Object nextElement() {
- return it.next();
- }
+ public Object nextElement() {
+ return it.next();
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IteratorPropertyAccessor.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IteratorPropertyAccessor.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IteratorPropertyAccessor.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/IteratorPropertyAccessor.java Thu Jan 22 22:32:36 2009
@@ -30,40 +30,40 @@
//--------------------------------------------------------------------------
package org.apache.ibatis.ognl;
-import java.util.*;
+import java.util.Iterator;
+import java.util.Map;
/**
* Implementation of PropertyAccessor that provides "property" reference to
* "next" and "hasNext".
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
public class IteratorPropertyAccessor extends ObjectPropertyAccessor
implements PropertyAccessor // This is here to make javadoc show this class as an implementor
{
- public Object getProperty( Map context, Object target, Object name ) throws OgnlException
- {
- Object result;
- Iterator iterator = (Iterator)target;
+ public Object getProperty(Map context, Object target, Object name) throws OgnlException {
+ Object result;
+ Iterator iterator = (Iterator) target;
- if ( name instanceof String ) {
- if (name.equals("next")) {
- result = iterator.next();
- } else {
- if (name.equals("hasNext")) {
- result = iterator.hasNext() ? Boolean.TRUE : Boolean.FALSE;
- } else {
- result = super.getProperty( context, target, name );
- }
- }
+ if (name instanceof String) {
+ if (name.equals("next")) {
+ result = iterator.next();
+ } else {
+ if (name.equals("hasNext")) {
+ result = iterator.hasNext() ? Boolean.TRUE : Boolean.FALSE;
} else {
- result = super.getProperty(context, target, name);
+ result = super.getProperty(context, target, name);
}
- return result;
+ }
+ } else {
+ result = super.getProperty(context, target, name);
}
+ return result;
+ }
- public void setProperty( Map context, Object target, Object name, Object value ) throws OgnlException
- {
- throw new IllegalArgumentException( "can't set property " + name + " on Iterator" );
- }
+ public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException {
+ throw new IllegalArgumentException("can't set property " + name + " on Iterator");
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/JJTOgnlParserState.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/JJTOgnlParserState.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/JJTOgnlParserState.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/JJTOgnlParserState.java Thu Jan 22 22:32:36 2009
@@ -6,8 +6,8 @@
private java.util.Stack nodes;
private java.util.Stack marks;
- private int sp; // number of nodes on stack
- private int mk; // current mark
+ private int sp; // number of nodes on stack
+ private int mk; // current mark
private boolean node_created;
JJTOgnlParserState() {
@@ -36,7 +36,7 @@
/* Returns the root node of the AST. It only makes sense to call
this after a successful parse. */
Node rootNode() {
- return (Node)nodes.elementAt(0);
+ return (Node) nodes.elementAt(0);
}
/* Pushes a node on to the stack. */
@@ -49,14 +49,14 @@
stack. */
Node popNode() {
if (--sp < mk) {
- mk = ((Integer)marks.pop()).intValue();
+ mk = ((Integer) marks.pop()).intValue();
}
- return (Node)nodes.pop();
+ return (Node) nodes.pop();
}
/* Returns the node currently on the top of the stack. */
Node peekNode() {
- return (Node)nodes.peek();
+ return (Node) nodes.peek();
}
/* Returns the number of children on the stack in the current node
@@ -70,7 +70,7 @@
while (sp > mk) {
popNode();
}
- mk = ((Integer)marks.pop()).intValue();
+ mk = ((Integer) marks.pop()).intValue();
}
@@ -86,7 +86,7 @@
made the children of the definite node. Then the definite node
is pushed on to the stack. */
void closeNodeScope(Node n, int num) {
- mk = ((Integer)marks.pop()).intValue();
+ mk = ((Integer) marks.pop()).intValue();
while (num-- > 0) {
Node c = popNode();
c.jjtSetParent(n);
@@ -106,17 +106,17 @@
void closeNodeScope(Node n, boolean condition) {
if (condition) {
int a = nodeArity();
- mk = ((Integer)marks.pop()).intValue();
+ mk = ((Integer) marks.pop()).intValue();
while (a-- > 0) {
- Node c = popNode();
- c.jjtSetParent(n);
- n.jjtAddChild(c, a);
+ Node c = popNode();
+ c.jjtSetParent(n);
+ n.jjtAddChild(c, a);
}
n.jjtClose();
pushNode(n);
node_created = true;
} else {
- mk = ((Integer)marks.pop()).intValue();
+ mk = ((Integer) marks.pop()).intValue();
node_created = false;
}
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/JavaCharStream.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/JavaCharStream.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/JavaCharStream.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/JavaCharStream.java Thu Jan 22 22:32:36 2009
@@ -6,51 +6,50 @@
* contain only ASCII characters (with java-like unicode escape processing).
*/
-public class JavaCharStream
-{
+public class JavaCharStream {
public static final boolean staticFlag = false;
+
static final int hexval(char c) throws java.io.IOException {
- switch(c)
- {
- case '0' :
- return 0;
- case '1' :
- return 1;
- case '2' :
- return 2;
- case '3' :
- return 3;
- case '4' :
- return 4;
- case '5' :
- return 5;
- case '6' :
- return 6;
- case '7' :
- return 7;
- case '8' :
- return 8;
- case '9' :
- return 9;
-
- case 'a' :
- case 'A' :
- return 10;
- case 'b' :
- case 'B' :
- return 11;
- case 'c' :
- case 'C' :
- return 12;
- case 'd' :
- case 'D' :
- return 13;
- case 'e' :
- case 'E' :
- return 14;
- case 'f' :
- case 'F' :
- return 15;
+ switch (c) {
+ case '0':
+ return 0;
+ case '1':
+ return 1;
+ case '2':
+ return 2;
+ case '3':
+ return 3;
+ case '4':
+ return 4;
+ case '5':
+ return 5;
+ case '6':
+ return 6;
+ case '7':
+ return 7;
+ case '8':
+ return 8;
+ case '9':
+ return 9;
+
+ case 'a':
+ case 'A':
+ return 10;
+ case 'b':
+ case 'B':
+ return 11;
+ case 'c':
+ case 'C':
+ return 12;
+ case 'd':
+ case 'D':
+ return 13;
+ case 'e':
+ case 'E':
+ return 14;
+ case 'f':
+ case 'F':
+ return 15;
}
throw new java.io.IOException(); // Should never come here
@@ -77,309 +76,269 @@
protected int nextCharInd = -1;
protected int inBuf = 0;
- protected void ExpandBuff(boolean wrapAround)
- {
- char[] newbuffer = new char[bufsize + 2048];
- int newbufline[] = new int[bufsize + 2048];
- int newbufcolumn[] = new int[bufsize + 2048];
-
- try
- {
- if (wrapAround)
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- System.arraycopy(buffer, 0, newbuffer,
- bufsize - tokenBegin, bufpos);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
- bufcolumn = newbufcolumn;
+ protected void ExpandBuff(boolean wrapAround) {
+ char[] newbuffer = new char[bufsize + 2048];
+ int newbufline[] = new int[bufsize + 2048];
+ int newbufcolumn[] = new int[bufsize + 2048];
+
+ try {
+ if (wrapAround) {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ System.arraycopy(buffer, 0, newbuffer,
+ bufsize - tokenBegin, bufpos);
+ buffer = newbuffer;
+
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+ bufline = newbufline;
+
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+ bufcolumn = newbufcolumn;
+
+ bufpos += (bufsize - tokenBegin);
+ } else {
+ System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+ buffer = newbuffer;
- bufpos += (bufsize - tokenBegin);
- }
- else
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- buffer = newbuffer;
+ System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+ bufline = newbufline;
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- bufline = newbufline;
+ System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+ bufcolumn = newbufcolumn;
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- bufcolumn = newbufcolumn;
+ bufpos -= tokenBegin;
+ }
+ }
+ catch (Throwable t) {
+ throw new Error(t.getMessage());
+ }
- bufpos -= tokenBegin;
- }
- }
- catch (Throwable t)
- {
- throw new Error(t.getMessage());
- }
-
- available = (bufsize += 2048);
- tokenBegin = 0;
- }
-
- protected void FillBuff() throws java.io.IOException
- {
- int i;
- if (maxNextCharInd == 4096)
- maxNextCharInd = nextCharInd = 0;
-
- try {
- if ((i = inputStream.read(nextCharBuf, maxNextCharInd,
- 4096 - maxNextCharInd)) == -1)
- {
- inputStream.close();
- throw new java.io.IOException();
- }
- else
- maxNextCharInd += i;
- return;
- }
- catch(java.io.IOException e) {
- if (bufpos != 0)
- {
- --bufpos;
- backup(0);
- }
- else
- {
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
- throw e;
- }
+ available = (bufsize += 2048);
+ tokenBegin = 0;
+ }
+
+ protected void FillBuff() throws java.io.IOException {
+ int i;
+ if (maxNextCharInd == 4096)
+ maxNextCharInd = nextCharInd = 0;
+
+ try {
+ if ((i = inputStream.read(nextCharBuf, maxNextCharInd,
+ 4096 - maxNextCharInd)) == -1) {
+ inputStream.close();
+ throw new java.io.IOException();
+ } else
+ maxNextCharInd += i;
+ return;
+ }
+ catch (java.io.IOException e) {
+ if (bufpos != 0) {
+ --bufpos;
+ backup(0);
+ } else {
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
+ }
+ throw e;
+ }
}
- protected char ReadByte() throws java.io.IOException
- {
- if (++nextCharInd >= maxNextCharInd)
- FillBuff();
+ protected char ReadByte() throws java.io.IOException {
+ if (++nextCharInd >= maxNextCharInd)
+ FillBuff();
- return nextCharBuf[nextCharInd];
+ return nextCharBuf[nextCharInd];
}
- public char BeginToken() throws java.io.IOException
- {
- if (inBuf > 0)
- {
- --inBuf;
+ public char BeginToken() throws java.io.IOException {
+ if (inBuf > 0) {
+ --inBuf;
- if (++bufpos == bufsize)
- bufpos = 0;
+ if (++bufpos == bufsize)
+ bufpos = 0;
- tokenBegin = bufpos;
- return buffer[bufpos];
- }
+ tokenBegin = bufpos;
+ return buffer[bufpos];
+ }
- tokenBegin = 0;
- bufpos = -1;
+ tokenBegin = 0;
+ bufpos = -1;
- return readChar();
- }
+ return readChar();
+ }
- protected void AdjustBuffSize()
- {
- if (available == bufsize)
- {
- if (tokenBegin > 2048)
- {
- bufpos = 0;
- available = tokenBegin;
- }
- else
- ExpandBuff(false);
- }
- else if (available > tokenBegin)
- available = bufsize;
- else if ((tokenBegin - available) < 2048)
- ExpandBuff(true);
- else
+ protected void AdjustBuffSize() {
+ if (available == bufsize) {
+ if (tokenBegin > 2048) {
+ bufpos = 0;
available = tokenBegin;
+ } else
+ ExpandBuff(false);
+ } else if (available > tokenBegin)
+ available = bufsize;
+ else if ((tokenBegin - available) < 2048)
+ ExpandBuff(true);
+ else
+ available = tokenBegin;
+ }
+
+ protected void UpdateLineColumn(char c) {
+ column++;
+
+ if (prevCharIsLF) {
+ prevCharIsLF = false;
+ line += (column = 1);
+ } else if (prevCharIsCR) {
+ prevCharIsCR = false;
+ if (c == '\n') {
+ prevCharIsLF = true;
+ } else
+ line += (column = 1);
+ }
+
+ switch (c) {
+ case '\r':
+ prevCharIsCR = true;
+ break;
+ case '\n':
+ prevCharIsLF = true;
+ break;
+ case '\t':
+ column--;
+ column += (8 - (column & 07));
+ break;
+ default:
+ break;
+ }
+
+ bufline[bufpos] = line;
+ bufcolumn[bufpos] = column;
}
- protected void UpdateLineColumn(char c)
- {
- column++;
-
- if (prevCharIsLF)
- {
- prevCharIsLF = false;
- line += (column = 1);
- }
- else if (prevCharIsCR)
- {
- prevCharIsCR = false;
- if (c == '\n')
- {
- prevCharIsLF = true;
- }
- else
- line += (column = 1);
- }
+ public char readChar() throws java.io.IOException {
+ if (inBuf > 0) {
+ --inBuf;
- switch (c)
- {
- case '\r' :
- prevCharIsCR = true;
- break;
- case '\n' :
- prevCharIsLF = true;
- break;
- case '\t' :
- column--;
- column += (8 - (column & 07));
- break;
- default :
- break;
- }
-
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
-
- public char readChar() throws java.io.IOException
- {
- if (inBuf > 0)
- {
- --inBuf;
-
- if (++bufpos == bufsize)
- bufpos = 0;
-
- return buffer[bufpos];
- }
+ if (++bufpos == bufsize)
+ bufpos = 0;
- char c;
+ return buffer[bufpos];
+ }
- if (++bufpos == available)
- AdjustBuffSize();
+ char c;
- if ((buffer[bufpos] = c = ReadByte()) == '\\')
- {
- UpdateLineColumn(c);
+ if (++bufpos == available)
+ AdjustBuffSize();
- int backSlashCnt = 1;
+ if ((buffer[bufpos] = c = ReadByte()) == '\\') {
+ UpdateLineColumn(c);
- for (;;) // Read all the backslashes
- {
- if (++bufpos == available)
- AdjustBuffSize();
-
- try
- {
- if ((buffer[bufpos] = c = ReadByte()) != '\\')
- {
- UpdateLineColumn(c);
- // found a non-backslash char.
- if ((c == 'u') && ((backSlashCnt & 1) == 1))
- {
- if (--bufpos < 0)
- bufpos = bufsize - 1;
-
- break;
- }
-
- backup(backSlashCnt);
- return '\\';
- }
- }
- catch(java.io.IOException e)
- {
- if (backSlashCnt > 1)
- backup(backSlashCnt);
+ int backSlashCnt = 1;
- return '\\';
- }
+ for (; ;) // Read all the backslashes
+ {
+ if (++bufpos == available)
+ AdjustBuffSize();
- UpdateLineColumn(c);
- backSlashCnt++;
- }
+ try {
+ if ((buffer[bufpos] = c = ReadByte()) != '\\') {
+ UpdateLineColumn(c);
+ // found a non-backslash char.
+ if ((c == 'u') && ((backSlashCnt & 1) == 1)) {
+ if (--bufpos < 0)
+ bufpos = bufsize - 1;
- // Here, we have seen an odd number of backslash's followed by a 'u'
- try
- {
- while ((c = ReadByte()) == 'u')
- ++column;
-
- buffer[bufpos] = c = (char)(hexval(c) << 12 |
- hexval(ReadByte()) << 8 |
- hexval(ReadByte()) << 4 |
- hexval(ReadByte()));
+ break;
+ }
- column += 4;
- }
- catch(java.io.IOException e)
- {
- throw new Error("Invalid escape character at line " + line +
- " column " + column + ".");
+ backup(backSlashCnt);
+ return '\\';
+ }
}
+ catch (java.io.IOException e) {
+ if (backSlashCnt > 1)
+ backup(backSlashCnt);
- if (backSlashCnt == 1)
- return c;
- else
- {
- backup(backSlashCnt - 1);
- return '\\';
+ return '\\';
}
- }
- else
- {
+
UpdateLineColumn(c);
- return (c);
- }
+ backSlashCnt++;
+ }
+
+ // Here, we have seen an odd number of backslash's followed by a 'u'
+ try {
+ while ((c = ReadByte()) == 'u')
+ ++column;
+
+ buffer[bufpos] = c = (char) (hexval(c) << 12 |
+ hexval(ReadByte()) << 8 |
+ hexval(ReadByte()) << 4 |
+ hexval(ReadByte()));
+
+ column += 4;
+ }
+ catch (java.io.IOException e) {
+ throw new Error("Invalid escape character at line " + line +
+ " column " + column + ".");
+ }
+
+ if (backSlashCnt == 1)
+ return c;
+ else {
+ backup(backSlashCnt - 1);
+ return '\\';
+ }
+ } else {
+ UpdateLineColumn(c);
+ return (c);
+ }
}
/**
- * @deprecated
* @see #getEndColumn
+ * @deprecated
*/
public int getColumn() {
- return bufcolumn[bufpos];
+ return bufcolumn[bufpos];
}
/**
- * @deprecated
* @see #getEndLine
+ * @deprecated
*/
public int getLine() {
- return bufline[bufpos];
+ return bufline[bufpos];
}
public int getEndColumn() {
- return bufcolumn[bufpos];
+ return bufcolumn[bufpos];
}
public int getEndLine() {
- return bufline[bufpos];
+ return bufline[bufpos];
}
public int getBeginColumn() {
- return bufcolumn[tokenBegin];
+ return bufcolumn[tokenBegin];
}
public int getBeginLine() {
- return bufline[tokenBegin];
+ return bufline[tokenBegin];
}
public void backup(int amount) {
inBuf += amount;
if ((bufpos -= amount) < 0)
- bufpos += bufsize;
+ bufpos += bufsize;
}
public JavaCharStream(java.io.Reader dstream,
- int startline, int startcolumn, int buffersize)
- {
+ int startline, int startcolumn, int buffersize) {
inputStream = dstream;
line = startline;
column = startcolumn - 1;
@@ -392,24 +351,21 @@
}
public JavaCharStream(java.io.Reader dstream,
- int startline, int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
+ int startline, int startcolumn) {
+ this(dstream, startline, startcolumn, 4096);
}
- public JavaCharStream(java.io.Reader dstream)
- {
- this(dstream, 1, 1, 4096);
+ public JavaCharStream(java.io.Reader dstream) {
+ this(dstream, 1, 1, 4096);
}
+
public void ReInit(java.io.Reader dstream,
- int startline, int startcolumn, int buffersize)
- {
+ int startline, int startcolumn, int buffersize) {
inputStream = dstream;
line = startline;
column = startcolumn - 1;
- if (buffer == null || buffersize != buffer.length)
- {
+ if (buffer == null || buffersize != buffer.length) {
available = bufsize = buffersize;
buffer = new char[buffersize];
bufline = new int[buffersize];
@@ -422,126 +378,110 @@
}
public void ReInit(java.io.Reader dstream,
- int startline, int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
+ int startline, int startcolumn) {
+ ReInit(dstream, startline, startcolumn, 4096);
}
- public void ReInit(java.io.Reader dstream)
- {
- ReInit(dstream, 1, 1, 4096);
+ public void ReInit(java.io.Reader dstream) {
+ ReInit(dstream, 1, 1, 4096);
}
+
public JavaCharStream(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ int startcolumn, int buffersize) {
+ this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
}
public JavaCharStream(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
+ int startcolumn) {
+ this(dstream, startline, startcolumn, 4096);
}
- public JavaCharStream(java.io.InputStream dstream)
- {
- this(dstream, 1, 1, 4096);
+ public JavaCharStream(java.io.InputStream dstream) {
+ this(dstream, 1, 1, 4096);
}
public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+ int startcolumn, int buffersize) {
+ ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
}
+
public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
- public void ReInit(java.io.InputStream dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
-
- public String GetImage()
- {
- if (bufpos >= tokenBegin)
- return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- else
- return new String(buffer, tokenBegin, bufsize - tokenBegin) +
- new String(buffer, 0, bufpos + 1);
- }
-
- public char[] GetSuffix(int len)
- {
- char[] ret = new char[len];
-
- if ((bufpos + 1) >= len)
- System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
- else
- {
- System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
- len - bufpos - 1);
- System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
- }
-
- return ret;
- }
-
- public void Done()
- {
- nextCharBuf = null;
- buffer = null;
- bufline = null;
- bufcolumn = null;
+ int startcolumn) {
+ ReInit(dstream, startline, startcolumn, 4096);
+ }
+
+ public void ReInit(java.io.InputStream dstream) {
+ ReInit(dstream, 1, 1, 4096);
+ }
+
+ public String GetImage() {
+ if (bufpos >= tokenBegin)
+ return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+ else
+ return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+ new String(buffer, 0, bufpos + 1);
+ }
+
+ public char[] GetSuffix(int len) {
+ char[] ret = new char[len];
+
+ if ((bufpos + 1) >= len)
+ System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+ else {
+ System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+ len - bufpos - 1);
+ System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+ }
+
+ return ret;
+ }
+
+ public void Done() {
+ nextCharBuf = null;
+ buffer = null;
+ bufline = null;
+ bufcolumn = null;
}
/**
* Method to adjust line and column numbers for the start of a token.
*/
- public void adjustBeginLineColumn(int newLine, int newCol)
- {
- int start = tokenBegin;
- int len;
-
- if (bufpos >= tokenBegin)
- {
- len = bufpos - tokenBegin + inBuf + 1;
- }
- else
- {
- len = bufsize - tokenBegin + bufpos + 1 + inBuf;
- }
-
- int i = 0, j = 0, k = 0;
- int nextColDiff = 0, columnDiff = 0;
-
- while (i < len &&
- bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
- {
- bufline[j] = newLine;
- nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
- bufcolumn[j] = newCol + columnDiff;
- columnDiff = nextColDiff;
- i++;
- }
-
- if (i < len)
- {
- bufline[j] = newLine++;
- bufcolumn[j] = newCol + columnDiff;
-
- while (i++ < len)
- {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
- bufline[j] = newLine++;
- else
- bufline[j] = newLine;
- }
- }
+ public void adjustBeginLineColumn(int newLine, int newCol) {
+ int start = tokenBegin;
+ int len;
+
+ if (bufpos >= tokenBegin) {
+ len = bufpos - tokenBegin + inBuf + 1;
+ } else {
+ len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+ }
+
+ int i = 0, j = 0, k = 0;
+ int nextColDiff = 0, columnDiff = 0;
+
+ while (i < len &&
+ bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) {
+ bufline[j] = newLine;
+ nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+ bufcolumn[j] = newCol + columnDiff;
+ columnDiff = nextColDiff;
+ i++;
+ }
+
+ if (i < len) {
+ bufline[j] = newLine++;
+ bufcolumn[j] = newCol + columnDiff;
+
+ while (i++ < len) {
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ bufline[j] = newLine++;
+ else
+ bufline[j] = newLine;
+ }
+ }
- line = bufline[j];
- column = bufcolumn[j];
+ line = bufline[j];
+ column = bufcolumn[j];
}
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/ListPropertyAccessor.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/ListPropertyAccessor.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/ListPropertyAccessor.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/ListPropertyAccessor.java Thu Jan 22 22:32:36 2009
@@ -30,93 +30,98 @@
//--------------------------------------------------------------------------
package org.apache.ibatis.ognl;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
/**
* Implementation of PropertyAccessor that uses numbers and dynamic subscripts as
* properties to index into Lists.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
public class ListPropertyAccessor extends ObjectPropertyAccessor
implements PropertyAccessor // This is here to make javadoc show this class as an implementor
{
- public Object getProperty( Map context, Object target, Object name ) throws OgnlException
- {
- List list = (List)target;
-
- if ( name instanceof String ) {
- Object result;
-
- if (name.equals("size")) {
- result = new Integer(list.size());
- } else {
- if (name.equals("iterator")) {
- result = list.iterator();
- } else {
- if (name.equals("isEmpty")) {
- result = list.isEmpty() ? Boolean.TRUE : Boolean.FALSE;
- } else {
- result = super.getProperty( context, target, name );
- }
- }
- }
- return result;
- }
+ public Object getProperty(Map context, Object target, Object name) throws OgnlException {
+ List list = (List) target;
- if ( name instanceof Number )
- return list.get( ((Number)name).intValue() );
+ if (name instanceof String) {
+ Object result;
- if ( name instanceof DynamicSubscript )
- {
- int len = list.size();
- switch ( ((DynamicSubscript)name).getFlag() )
- {
- case DynamicSubscript.FIRST: return len > 0? list.get(0) : null;
- case DynamicSubscript.MID: return len > 0? list.get(len/2) : null;
- case DynamicSubscript.LAST: return len > 0? list.get(len-1) : null;
- case DynamicSubscript.ALL: return new ArrayList(list);
- }
+ if (name.equals("size")) {
+ result = new Integer(list.size());
+ } else {
+ if (name.equals("iterator")) {
+ result = list.iterator();
+ } else {
+ if (name.equals("isEmpty")) {
+ result = list.isEmpty() ? Boolean.TRUE : Boolean.FALSE;
+ } else {
+ result = super.getProperty(context, target, name);
}
+ }
+ }
+ return result;
+ }
- throw new NoSuchPropertyException( target, name );
+ if (name instanceof Number)
+ return list.get(((Number) name).intValue());
+
+ if (name instanceof DynamicSubscript) {
+ int len = list.size();
+ switch (((DynamicSubscript) name).getFlag()) {
+ case DynamicSubscript.FIRST:
+ return len > 0 ? list.get(0) : null;
+ case DynamicSubscript.MID:
+ return len > 0 ? list.get(len / 2) : null;
+ case DynamicSubscript.LAST:
+ return len > 0 ? list.get(len - 1) : null;
+ case DynamicSubscript.ALL:
+ return new ArrayList(list);
+ }
}
- public void setProperty( Map context, Object target, Object name, Object value ) throws OgnlException
- {
- if ( name instanceof String )
- {
- super.setProperty( context, target, name, value );
- return;
- }
+ throw new NoSuchPropertyException(target, name);
+ }
- List list = (List)target;
+ public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException {
+ if (name instanceof String) {
+ super.setProperty(context, target, name, value);
+ return;
+ }
- if ( name instanceof Number )
- {
- list.set( ((Number)name).intValue(), value );
- return;
- }
+ List list = (List) target;
- if ( name instanceof DynamicSubscript )
- {
- int len = list.size();
- switch ( ((DynamicSubscript)name).getFlag() )
- {
- case DynamicSubscript.FIRST: if ( len > 0 ) list.set(0,value); return;
- case DynamicSubscript.MID: if ( len > 0 ) list.set(len/2,value); return;
- case DynamicSubscript.LAST: if ( len > 0 ) list.set(len-1,value); return;
- case DynamicSubscript.ALL:
- {
- if ( !(value instanceof Collection) )
- throw new OgnlException( "Value must be a collection" );
- list.clear();
- list.addAll( (Collection)value );
- return;
- }
- }
- }
+ if (name instanceof Number) {
+ list.set(((Number) name).intValue(), value);
+ return;
+ }
- throw new NoSuchPropertyException( target, name );
+ if (name instanceof DynamicSubscript) {
+ int len = list.size();
+ switch (((DynamicSubscript) name).getFlag()) {
+ case DynamicSubscript.FIRST:
+ if (len > 0) list.set(0, value);
+ return;
+ case DynamicSubscript.MID:
+ if (len > 0) list.set(len / 2, value);
+ return;
+ case DynamicSubscript.LAST:
+ if (len > 0) list.set(len - 1, value);
+ return;
+ case DynamicSubscript.ALL: {
+ if (!(value instanceof Collection))
+ throw new OgnlException("Value must be a collection");
+ list.clear();
+ list.addAll((Collection) value);
+ return;
+ }
+ }
}
+
+ throw new NoSuchPropertyException(target, name);
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MapElementsAccessor.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MapElementsAccessor.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MapElementsAccessor.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MapElementsAccessor.java Thu Jan 22 22:32:36 2009
@@ -30,17 +30,17 @@
//--------------------------------------------------------------------------
package org.apache.ibatis.ognl;
-import java.util.*;
+import java.util.Enumeration;
+import java.util.Map;
/**
* Implementation of ElementsAccessor that returns an iterator over the map's values.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class MapElementsAccessor implements ElementsAccessor
-{
- public Enumeration getElements( Object target )
- {
- return new IteratorEnumeration( ((Map)target).values().iterator() );
- }
+public class MapElementsAccessor implements ElementsAccessor {
+ public Enumeration getElements(Object target) {
+ return new IteratorEnumeration(((Map) target).values().iterator());
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MapPropertyAccessor.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MapPropertyAccessor.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MapPropertyAccessor.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MapPropertyAccessor.java Thu Jan 22 22:32:36 2009
@@ -30,59 +30,57 @@
//--------------------------------------------------------------------------
package org.apache.ibatis.ognl;
-import java.util.*;
+import java.util.Map;
/**
* Implementation of PropertyAccessor that sets and gets properties by storing and looking
* up values in Maps.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class MapPropertyAccessor implements PropertyAccessor
-{
- public Object getProperty( Map context, Object target, Object name ) throws OgnlException
- {
- Object result;
- Map map = (Map)target;
- Node currentNode = ((OgnlContext)context).getCurrentNode().jjtGetParent();
- boolean indexedAccess = false;
+public class MapPropertyAccessor implements PropertyAccessor {
+ public Object getProperty(Map context, Object target, Object name) throws OgnlException {
+ Object result;
+ Map map = (Map) target;
+ Node currentNode = ((OgnlContext) context).getCurrentNode().jjtGetParent();
+ boolean indexedAccess = false;
- if (currentNode == null) {
- throw new OgnlException("node is null for '" + name + "'");
- }
- if (!(currentNode instanceof ASTProperty)) {
- currentNode = currentNode.jjtGetParent();
- }
- if (currentNode instanceof ASTProperty) {
- indexedAccess = ((ASTProperty)currentNode).isIndexedAccess();
- }
- if ( (name instanceof String) && !indexedAccess ) {
- if (name.equals("size")) {
- result = new Integer(map.size());
+ if (currentNode == null) {
+ throw new OgnlException("node is null for '" + name + "'");
+ }
+ if (!(currentNode instanceof ASTProperty)) {
+ currentNode = currentNode.jjtGetParent();
+ }
+ if (currentNode instanceof ASTProperty) {
+ indexedAccess = ((ASTProperty) currentNode).isIndexedAccess();
+ }
+ if ((name instanceof String) && !indexedAccess) {
+ if (name.equals("size")) {
+ result = new Integer(map.size());
+ } else {
+ if (name.equals("keys")) {
+ result = map.keySet();
+ } else {
+ if (name.equals("values")) {
+ result = map.values();
+ } else {
+ if (name.equals("isEmpty")) {
+ result = map.isEmpty() ? Boolean.TRUE : Boolean.FALSE;
} else {
- if (name.equals("keys")) {
- result = map.keySet();
- } else {
- if (name.equals("values")) {
- result = map.values();
- } else {
- if (name.equals("isEmpty")) {
- result = map.isEmpty() ? Boolean.TRUE : Boolean.FALSE;
- } else {
- result = map.get(name);
- }
- }
- }
+ result = map.get(name);
}
- } else {
- result = map.get(name);
+ }
}
- return result;
+ }
+ } else {
+ result = map.get(name);
}
+ return result;
+ }
- public void setProperty( Map context, Object target, Object name, Object value ) throws OgnlException
- {
- Map map = (Map)target;
- map.put( name, value );
- }
+ public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException {
+ Map map = (Map) target;
+ map.put(name, value);
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MemberAccess.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MemberAccess.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MemberAccess.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MemberAccess.java Thu Jan 22 22:32:36 2009
@@ -42,21 +42,20 @@
* @author Drew Davidson (drew@ognl.org)
* @version 15 October 1999
*/
-public interface MemberAccess
-{
- /**
- Sets the member up for accessibility
- */
- public Object setup(Map context, Object target, Member member, String propertyName);
+public interface MemberAccess {
+ /**
+ * Sets the member up for accessibility
+ */
+ public Object setup(Map context, Object target, Member member, String propertyName);
- /**
- Restores the member from the previous setup call.
- */
- public void restore(Map context, Object target, Member member, String propertyName, Object state);
+ /**
+ * Restores the member from the previous setup call.
+ */
+ public void restore(Map context, Object target, Member member, String propertyName, Object state);
- /**
- Returns true if the given member is accessible or can be made accessible
- by this object.
- */
- public boolean isAccessible(Map context, Object target, Member member, String propertyName);
+ /**
+ * Returns true if the given member is accessible or can be made accessible
+ * by this object.
+ */
+ public boolean isAccessible(Map context, Object target, Member member, String propertyName);
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MethodAccessor.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MethodAccessor.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MethodAccessor.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MethodAccessor.java Thu Jan 22 22:32:36 2009
@@ -36,30 +36,32 @@
* This interface defines methods for callinig methods in a target object.
* Methods are broken up into static and instance methods for convenience.
* indexes into the target object, which must be an array.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public interface MethodAccessor
-{
- /**
- * Calls the static method named with the arguments given on the class given.
- * @param context expression context in which the method should be called
- * @param targetClass the object in which the method exists
- * @param methodName the name of the method
- * @param args the arguments to the method
- * @result result of calling the method
- * @exception MethodFailedException if there is an error calling the method
- */
- Object callStaticMethod( Map context, Class targetClass, String methodName, Object[] args ) throws MethodFailedException;
+public interface MethodAccessor {
+ /**
+ * Calls the static method named with the arguments given on the class given.
+ *
+ * @param context expression context in which the method should be called
+ * @param targetClass the object in which the method exists
+ * @param methodName the name of the method
+ * @param args the arguments to the method
+ * @throws MethodFailedException if there is an error calling the method
+ * @result result of calling the method
+ */
+ Object callStaticMethod(Map context, Class targetClass, String methodName, Object[] args) throws MethodFailedException;
- /**
- * Calls the method named with the arguments given.
- * @param context expression context in which the method should be called
- * @param target the object in which the method exists
- * @param methodName the name of the method
- * @param args the arguments to the method
- * @result result of calling the method
- * @exception MethodFailedException if there is an error calling the method
- */
- Object callMethod( Map context, Object target, String methodName, Object[] args ) throws MethodFailedException;
+ /**
+ * Calls the method named with the arguments given.
+ *
+ * @param context expression context in which the method should be called
+ * @param target the object in which the method exists
+ * @param methodName the name of the method
+ * @param args the arguments to the method
+ * @throws MethodFailedException if there is an error calling the method
+ * @result result of calling the method
+ */
+ Object callMethod(Map context, Object target, String methodName, Object[] args ) throws MethodFailedException;
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MethodFailedException.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MethodFailedException.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MethodFailedException.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/MethodFailedException.java Thu Jan 22 22:32:36 2009
@@ -32,13 +32,12 @@
/**
* Exception thrown if a method or constructor call fails.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class MethodFailedException extends OgnlException
-{
- public MethodFailedException( Object source, String name, Throwable reason )
- {
- super( "Method \"" + name + "\" failed for object " + source, reason );
- }
+public class MethodFailedException extends OgnlException {
+ public MethodFailedException(Object source, String name, Throwable reason) {
+ super("Method \"" + name + "\" failed for object " + source, reason);
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/NoSuchPropertyException.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/NoSuchPropertyException.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/NoSuchPropertyException.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/NoSuchPropertyException.java Thu Jan 22 22:32:36 2009
@@ -34,33 +34,29 @@
/**
* Exception thrown if a property is attempted to be extracted from an object that does
* not have such a property.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class NoSuchPropertyException extends OgnlException
-{
- private Object target;
- private Object name;
+public class NoSuchPropertyException extends OgnlException {
+ private Object target;
+ private Object name;
- public NoSuchPropertyException( Object target, Object name, Throwable reason )
- {
- super( ((target instanceof Class) ? target.toString() : target.getClass().getName()) + "." + name, reason );
- this.target = target;
- this.name = name;
- }
+ public NoSuchPropertyException(Object target, Object name, Throwable reason) {
+ super(((target instanceof Class) ? target.toString() : target.getClass().getName()) + "." + name, reason);
+ this.target = target;
+ this.name = name;
+ }
- public NoSuchPropertyException( Object target, Object name )
- {
- this( target, name, null );
- }
+ public NoSuchPropertyException(Object target, Object name) {
+ this(target, name, null);
+ }
- public Object getTarget()
- {
- return target;
- }
+ public Object getTarget() {
+ return target;
+ }
- public Object getName()
- {
- return name;
- }
+ public Object getName() {
+ return name;
+ }
}
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/Node.java
URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/Node.java?rev=736963&r1=736962&r2=736963&view=diff
==============================================================================
--- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/Node.java (original)
+++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/ognl/Node.java Thu Jan 22 22:32:36 2009
@@ -31,55 +31,66 @@
package org.apache.ibatis.ognl;
/**
- JJTree interface for AST nodes, as modified to handle the OGNL operations getValue and
- setValue. JJTree's original comment:
-
- All AST nodes must implement this interface. It provides basic
- machinery for constructing the parent and child relationships
- between nodes.
-
- @author Luke Blanshard (blanshlu@netscape.net)
- @author Drew Davidson (drew@ognl.org)
-*/
-public interface Node
-{
-
- /** This method is called after the node has been made the current
- node. It indicates that child nodes can now be added to it. */
- public void jjtOpen();
-
- /** This method is called after all the child nodes have been
- added. */
- public void jjtClose();
-
- /** This pair of methods are used to inform the node of its
- parent. */
- public void jjtSetParent(Node n);
- public Node jjtGetParent();
-
- /** This method tells the node to add its argument to the node's
- list of children. */
- public void jjtAddChild(Node n, int i);
-
- /** This method returns a child node. The children are numbered
- from zero, left to right. */
- public Node jjtGetChild(int i);
-
- /** Return the number of children the node has. */
- public int jjtGetNumChildren();
-
+ * JJTree interface for AST nodes, as modified to handle the OGNL operations getValue and
+ * setValue. JJTree's original comment:
+ * <p/>
+ * All AST nodes must implement this interface. It provides basic
+ * machinery for constructing the parent and child relationships
+ * between nodes.
+ *
+ * @author Luke Blanshard (blanshlu@netscape.net)
+ * @author Drew Davidson (drew@ognl.org)
+ */
+public interface Node {
+
+ /**
+ * This method is called after the node has been made the current
+ * node. It indicates that child nodes can now be added to it.
+ */
+ public void jjtOpen();
+
+ /**
+ * This method is called after all the child nodes have been
+ * added.
+ */
+ public void jjtClose();
+
+ /**
+ * This pair of methods are used to inform the node of its
+ * parent.
+ */
+ public void jjtSetParent(Node n);
+
+ public Node jjtGetParent();
+
+ /**
+ * This method tells the node to add its argument to the node's
+ * list of children.
+ */
+ public void jjtAddChild(Node n, int i);
+
+ /**
+ * This method returns a child node. The children are numbered
+ * from zero, left to right.
+ */
+ public Node jjtGetChild(int i);
+
+ /**
+ * Return the number of children the node has.
+ */
+ public int jjtGetNumChildren();
// OGNL additions to Node:
- /**
- * Extracts the value from the given source object that is appropriate for this node
- * within the given context.
- */
- public Object getValue( OgnlContext context, Object source ) throws OgnlException;
-
- /**
- * Sets the given value in the given target as appropriate for this node within the
- * given context.
- */
- public void setValue( OgnlContext context, Object target, Object value ) throws OgnlException;
+ /**
+ * Extracts the value from the given source object that is appropriate for this node
+ * within the given context.
+ */
+ public Object getValue(OgnlContext context, Object source) throws OgnlException;
+
+ /**
+ * Sets the given value in the given target as appropriate for this node within the
+ * given context.
+ */
+ public void setValue(OgnlContext context, Object target, Object value) throws OgnlException;
}