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(); }
ResolvedNode resolved = context.resolve(argument); if (resolved != null) { for (ResolvedAnnotation annotation : resolved.getAnnotations()) { String signature = annotation.getSignature(); if (signature.equals(COLOR_INT_ANNOTATION)) {
JavaParser.ResolvedNode resolved = mContext.resolve(typeReference); if (resolved != null) { fqcn = resolved.getSignature(); } else if (typeReference.getTypeName().equals( "ReflectiveOperationException")) {
/** * Searches for the annotation of the given type on this node * * @param type the fully qualified name of the annotation to check * @return the annotation, or null if not found */ @Nullable public ResolvedAnnotation getAnnotation(@NonNull String type) { for (ResolvedAnnotation annotation : getAnnotations()) { if (annotation.getType().matchesSignature(type)) { return annotation; } } return null; }
@Override public String toString() { return getSignature(); }
/** * 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); }