Implement decent string representation for path object.
This commit is contained in:
parent
6bd558bcb0
commit
2b48e43964
2 changed files with 29 additions and 0 deletions
|
@ -142,4 +142,19 @@ public class RequestPath {
|
||||||
return objects.indexOf(obj);
|
return objects.indexOf(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a string representation of the Request Path
|
||||||
|
*/
|
||||||
|
public String toString() {
|
||||||
|
// If there's just one element we're on the root object.
|
||||||
|
if (ids.size() <= 1)
|
||||||
|
return "/";
|
||||||
|
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
for (int i=1; i<ids.size(); i++) {
|
||||||
|
buffer.append('/');
|
||||||
|
buffer.append(ids.get(i));
|
||||||
|
}
|
||||||
|
return buffer.toString();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -143,4 +143,18 @@ public class PathWrapper extends ScriptableObject {
|
||||||
return "[PathWrapper]";
|
return "[PathWrapper]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "PathWrapper["+path.toString()+"]";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a primitive representation for this object.
|
||||||
|
* FIXME: We always return a string representation.
|
||||||
|
*
|
||||||
|
* @param hint the type hint
|
||||||
|
* @return the default value for the object
|
||||||
|
*/
|
||||||
|
public Object getDefaultValue(Class hint) {
|
||||||
|
return toString();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue