MCPcopy Index your code
hub / github.com/apache/groovy / getClassProps

Method getClassProps

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

Get the Class Properties of the object under inspection. @return String array to be indexed by the CLASS_xxx_IDX constants

()

Source from the content-addressed store, hash-verified

134 * @return String array to be indexed by the CLASS_xxx_IDX constants
135 */
136 public String[] getClassProps() {
137 String[] result = new String[CLASS_OTHER_IDX + 1];
138 Package pack = getClassUnderInspection().getPackage();
139 result[CLASS_PACKAGE_IDX] = "package " + ((pack == null) ? NOT_APPLICABLE : pack.getName());
140 String modifiers = Modifier.toString(getClassUnderInspection().getModifiers());
141 result[CLASS_CLASS_IDX] = modifiers + " class " + shortName(getClassUnderInspection());
142 result[CLASS_INTERFACE_IDX] = "implements ";
143 Class[] interfaces = getClassUnderInspection().getInterfaces();
144 for (Class anInterface : interfaces) {
145 result[CLASS_INTERFACE_IDX] += shortName(anInterface) + " ";
146 }
147 result[CLASS_SUPERCLASS_IDX] = "extends " + shortName(getClassUnderInspection().getSuperclass());
148 result[CLASS_OTHER_IDX] = "is Primitive: " + getClassUnderInspection().isPrimitive()
149 + ", is Array: " + getClassUnderInspection().isArray()
150 + ", is Groovy: " + isGroovy();
151 return result;
152 }
153
154 /**
155 * Indicates whether the inspected type implements {@link GroovyObject}.

Callers 2

testClassPropsJavaMethod · 0.95
testClassPropsGroovyMethod · 0.95

Calls 10

shortNameMethod · 0.95
isGroovyMethod · 0.95
getNameMethod · 0.65
toStringMethod · 0.65
getModifiersMethod · 0.65
isPrimitiveMethod · 0.65
getPackageMethod · 0.45
getInterfacesMethod · 0.45
isArrayMethod · 0.45

Tested by 2

testClassPropsJavaMethod · 0.76
testClassPropsGroovyMethod · 0.76