/** * Returns the value for the represented field from the parent object inspector node * If this field is an array, the value from the array index represented * by this node is returned. When access to the array is needed, e.g. to * create the the node children, use getFieldValue() instead. * @return */ protected Object getArrayValue() { try { if (isArrayNode()) { return Array.get(field.get(((ObjectInspectorNode)parent).getNodeObject()), ((ObjectInspectorNode)parent).getChildren().indexOf(this)/*-1*/); } else return "-ERROR- getArrayValue called on a non array type"; } catch (Exception e) { //e.printStackTrace(); return "-ERROR- Exception occurred: " + e; } }
node.children = oldchildren; if (node.isArrayNode())
/** * Get a string representation of this node */ public String toString() { String len = ""; try { //if (type.isArray()) if (isArrayNode()) { Object arrayValue = getFieldValue(); len = (arrayValue !=null ? ""+ Array.getLength(arrayValue) : "null"); } } catch (Exception e) { e.printStackTrace(); len = "-ERROR-"; } return (name != null ? name : "?? INVALID NODE NAME ??") //+ (type.isArray() ? "["+len+"]" : "") + (isArrayNode() ? "["+len+"]" : "") //+ (attributeValue!=null? " = "+attributeValue: " (null)") ; }