MCPcopy Create free account
hub / github.com/apache/pig / append

Method append

src/org/apache/pig/scripting/js/JsFunction.java:132–156  ·  view source on GitHub ↗

debug utility to display a JS object @param buffer whil append the representation here @param object special treatment if a javascript object

(StringBuffer buffer, Object object)

Source from the content-addressed store, hash-verified

130 * @param object special treatment if a javascript object
131 */
132 private void append(StringBuffer buffer, Object object) {
133 if (object instanceof Scriptable) {
134 Scriptable scriptable = (Scriptable) object;
135 buffer.append("{");
136 boolean first = true;
137 for (Object id : scriptable.getIds()) {
138 if (first) {
139 first = false;
140 } else {
141 buffer.append(", ");
142 }
143 if (id instanceof String) {
144 buffer.append(id).append(": ");
145 append(buffer, scriptable.get((String)id, jsScriptEngine.getScope()));
146 } else {
147 buffer.append("[").append(id).append("]: ");
148 append(buffer, scriptable.get((Integer)id, jsScriptEngine.getScope()));
149 }
150 }
151 buffer.append("}");
152
153 } else {
154 buffer.append(object);
155 }
156 }
157
158 /**
159 * debug utility to display a JS object

Callers 1

toStringMethod · 0.95

Calls 3

appendMethod · 0.65
getMethod · 0.65
getScopeMethod · 0.45

Tested by

no test coverage detected