/** * Inspects returns the String that matches what would be typed into a * terminal to create this object. * * @param self any Object * @return a String that matches what would be typed into a terminal to * create this object. e.g. [1, 'hello'].inspect() -> [1, "hello"] * @since 1.0 */ public static String inspect(Object self) { return InvokerHelper.inspect(self); }
private static void writeValue(String key, String space, String prefix, Object value, BufferedWriter out) throws IOException { // key = key.indexOf('.') > -1 ? InvokerHelper.inspect(key) : key; boolean isKeyword = KEYWORDS.contains(key); key = isKeyword ? InvokerHelper.inspect(key) : key; if (!StringGroovyMethods.asBoolean(prefix) && isKeyword) prefix = "this."; out.append(space).append(prefix).append(key).append('=').append(InvokerHelper.inspect(value)); out.newLine(); }
private void writeNode(String key, String space, int tab, ConfigObject value, BufferedWriter out) throws IOException { key = KEYWORDS.contains(key) ? InvokerHelper.inspect(key) : key; out.append(space).append(key).append(" {"); out.newLine(); writeConfig("", value, out, tab + 1, true); out.append(space).append('}'); out.newLine(); }
protected String[] fieldInfo(Field field) { String[] result = new String[MEMBER_VALUE_IDX + 1]; result[MEMBER_ORIGIN_IDX] = JAVA; result[MEMBER_MODIFIER_IDX] = Modifier.toString(field.getModifiers()); result[MEMBER_DECLARER_IDX] = shortName(field.getDeclaringClass()); result[MEMBER_TYPE_IDX] = shortName(field.getType()); result[MEMBER_NAME_IDX] = field.getName(); try { result[MEMBER_VALUE_IDX] = InvokerHelper.inspect(field.get(objectUnderInspection)); } catch (IllegalAccessException e) { result[MEMBER_VALUE_IDX] = NOT_APPLICABLE; } return withoutNulls(result); }
protected String[] fieldInfo(PropertyValue pv) { String[] result = new String[MEMBER_VALUE_IDX + 1]; result[MEMBER_ORIGIN_IDX] = GROOVY; result[MEMBER_MODIFIER_IDX] = "public"; result[MEMBER_DECLARER_IDX] = NOT_APPLICABLE; result[MEMBER_TYPE_IDX] = shortName(pv.getType()); result[MEMBER_NAME_IDX] = pv.getName(); try { result[MEMBER_VALUE_IDX] = InvokerHelper.inspect(pv.getValue()); } catch (Exception e) { result[MEMBER_VALUE_IDX] = NOT_APPLICABLE; } return withoutNulls(result); }
key = KEYWORDS.contains(key) ? InvokerHelper.inspect(key) : key; String writePrefix = prefix + key + "." + firstKey + "."; writeConfig(writePrefix, (ConfigObject) firstValue, out, tab, true); for (Object j : value.keySet()) { Object v2 = value.get(j); Object k2 = ((String) j).indexOf('.') > -1 ? InvokerHelper.inspect(j) : j; if (v2 instanceof ConfigObject) { key = KEYWORDS.contains(key) ? InvokerHelper.inspect(key) : key; writeConfig(prefix + key, (ConfigObject) v2, out, tab, false); } else {
/** * Inspects returns the String that matches what would be typed into a * terminal to create this object. * * @param self any Object * @return a String that matches what would be typed into a terminal to * create this object. e.g. [1, 'hello'].inspect() -> [1, "hello"] * @since 1.0 */ public static String inspect(Object self) { return InvokerHelper.inspect(self); }
/** * Inspects returns the String that matches what would be typed into a * terminal to create this object. * * @param self any Object * @return a String that matches what would be typed into a terminal to * create this object. e.g. [1, 'hello'].inspect() -> [1, "hello"] * @since 1.0 */ public static String inspect(Object self) { return InvokerHelper.inspect(self); }
/** * Inspects returns the String that matches what would be typed into a * terminal to create this object. * * @param self any Object * @return a String that matches what would be typed into a terminal to * create this object. e.g. [1, 'hello'].inspect() -> [1, "hello"] * @since 1.0 */ public static String inspect(Object self) { return InvokerHelper.inspect(self); }
private void writeValue(String key, String space, String prefix, Object value, BufferedWriter out) throws IOException { // key = key.indexOf('.') > -1 ? InvokerHelper.inspect(key) : key; boolean isKeyword = KEYWORDS.contains(key); key = isKeyword ? InvokerHelper.inspect(key) : key; if (!DefaultGroovyMethods.asBoolean(prefix) && isKeyword) prefix = "this."; out.append(space).append(prefix).append(key).append('=').append(InvokerHelper.inspect(value)); out.newLine(); }
private void writeNode(String key, String space, int tab, ConfigObject value, BufferedWriter out) throws IOException { key = KEYWORDS.contains(key) ? InvokerHelper.inspect(key) : key; out.append(space).append(key).append(" {"); out.newLine(); writeConfig("", value, out, tab + 1, true); out.append(space).append('}'); out.newLine(); }