1 61 62 63 64 package org.jaxen.expr; 65 66 import java.util.Iterator ; 67 import java.util.List ; 68 69 import org.jaxen.util.SingleObjectIterator; 70 import org.jaxen.util.SingletonList; 71 72 public abstract class DefaultExpr implements Expr 73 { 74 public Expr simplify() 75 { 76 return this; 77 } 78 79 static public Iterator convertToIterator(Object obj) 80 { 81 if ( obj instanceof Iterator ) 82 { 83 return (Iterator ) obj; 84 } 85 86 if ( obj instanceof List ) 87 { 88 return ((List )obj).iterator(); 89 } 90 91 return new SingleObjectIterator( obj ); 92 } 93 94 static public List convertToList(Object obj) 95 { 96 if ( obj instanceof List ) 97 { 98 return (List ) obj; 99 } 100 101 return new SingletonList(obj); 102 } 103 } 104 | Popular Tags |