GenericObject can now (true to its name) wrap any Java object,
not just the ones implementing IPathElement.
This commit is contained in:
parent
fda2b76a49
commit
50d49d0484
1 changed files with 7 additions and 7 deletions
|
@ -13,17 +13,17 @@ import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* A wrapper for a Java object that may or may not implement the IPathElement interface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ESGenericObject extends ObjectPrototype {
|
public class ESGenericObject extends ObjectPrototype {
|
||||||
|
|
||||||
ESWrapper wrapper;
|
ESWrapper wrapper;
|
||||||
IPathElement pathObj;
|
Object wrappedObject;
|
||||||
|
|
||||||
public ESGenericObject (ESObject prototype, Evaluator evaluator, IPathElement obj) {
|
public ESGenericObject (ESObject prototype, Evaluator evaluator, Object obj) {
|
||||||
super (prototype, evaluator);
|
super (prototype, evaluator);
|
||||||
pathObj = obj;
|
wrappedObject = obj;
|
||||||
wrapper = new ESWrapper (obj, evaluator);
|
wrapper = new ESWrapper (obj, evaluator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class ESGenericObject extends ObjectPrototype {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString () {
|
public String toString () {
|
||||||
return pathObj.toString ();
|
return wrappedObject.toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toDetailString () {
|
public String toDetailString () {
|
||||||
|
@ -85,7 +85,7 @@ public class ESGenericObject extends ObjectPrototype {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object toJavaObject () {
|
public Object toJavaObject () {
|
||||||
return pathObj;
|
return wrappedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,7 +99,7 @@ public class ESGenericObject extends ObjectPrototype {
|
||||||
return true;
|
return true;
|
||||||
if (what instanceof ESGenericObject) {
|
if (what instanceof ESGenericObject) {
|
||||||
ESGenericObject other = (ESGenericObject) what;
|
ESGenericObject other = (ESGenericObject) what;
|
||||||
return (pathObj.equals (other.pathObj));
|
return (wrappedObject.equals (other.wrappedObject));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue