MCPcopy
hub / github.com/apache/groovy / fieldWithInfo

Method fieldWithInfo

src/main/java/groovy/inspect/Inspector.java:327–343  ·  view source on GitHub ↗

Builds the value and metadata tuple for a Groovy property. @param pv the property value to describe @return the property tuple

(PropertyValue pv)

Source from the content-addressed store, hash-verified

325 * @return the property tuple
326 */
327 protected Tuple2<Object, String[]> fieldWithInfo(PropertyValue pv) {
328 String[] info = new String[MEMBER_VALUE_IDX + 1];
329 info[MEMBER_ORIGIN_IDX] = GROOVY;
330 info[MEMBER_MODIFIER_IDX] = "public";
331 info[MEMBER_DECLARER_IDX] = NOT_APPLICABLE;
332 info[MEMBER_TYPE_IDX] = shortName(pv.getType());
333 info[MEMBER_NAME_IDX] = pv.getName();
334 Object field = null;
335 try {
336 field = pv.getValue();
337 info[MEMBER_VALUE_IDX] = FormatHelper.inspect(field);
338 } catch (Exception e) {
339 info[MEMBER_VALUE_IDX] = NOT_APPLICABLE;
340 }
341 info = withoutNulls(info);
342 return new Tuple2<>(field, info);
343 }
344
345 /**
346 * Gets the class of the inspected object.

Callers 2

fieldInfoMethod · 0.95
getPropertiesWithInfoMethod · 0.95

Calls 6

shortNameMethod · 0.95
inspectMethod · 0.95
withoutNullsMethod · 0.95
getTypeMethod · 0.65
getNameMethod · 0.65
getValueMethod · 0.65

Tested by

no test coverage detected