private static String listAllowedValues(@NonNull Object[] allowedValues) { StringBuilder sb = new StringBuilder(); for (Object allowedValue : allowedValues) { String s; if (allowedValue instanceof Integer) { s = allowedValue.toString(); } else if (allowedValue instanceof ResolvedNode) { ResolvedNode node = (ResolvedNode) allowedValue; if (node instanceof ResolvedField) { ResolvedField field = (ResolvedField) node; String containingClassName = field.getContainingClassName(); containingClassName = containingClassName.substring(containingClassName.lastIndexOf('.') + 1); s = containingClassName + "." + field.getName(); } else { s = node.getSignature(); } } else { continue; } if (sb.length() > 0) { sb.append(", "); } sb.append(s); } return sb.toString(); }
/** * Returns true if this element is in the given package (or optionally, in one of its sub * packages) * * @param pkg the package name * @param includeSubPackages whether to include subpackages * @return true if the element is in the given package */ public boolean isInPackage(@NonNull String pkg, boolean includeSubPackages) { return getSignature().startsWith(pkg); }
JavaParser.ResolvedNode resolved = mContext.resolve(typeReference); if (resolved != null) { fqcn = resolved.getSignature(); } else if (typeReference.getTypeName().equals( "ReflectiveOperationException")) {
@Override public String toString() { return getSignature(); }