/** {@inheritDoc} */ public String resolve(TypeDescription instrumentedType) { return instrumentedType.getCanonicalName(); } },
/** * {@inheritDoc} */ public String getCanonicalName() { return delegate.getCanonicalName(); }
/** * {@inheritDoc} */ public String getCanonicalName() { String canonicalName = componentType.getCanonicalName(); if (canonicalName == null) { return NO_NAME; } StringBuilder stringBuilder = new StringBuilder(canonicalName); for (int i = 0; i < arity; i++) { stringBuilder.append("[]"); } return stringBuilder.toString(); }
/** * {@inheritDoc} */ public String getCanonicalName() { if (isAnonymousType() || isLocalType()) { return NO_NAME; } String internalName = getInternalName(); TypeDescription enclosingType = getEnclosingType(); if (enclosingType != null && internalName.startsWith(enclosingType.getInternalName() + "$")) { return enclosingType.getCanonicalName() + "." + internalName.substring(enclosingType.getInternalName().length() + 1); } else { return getName(); } }
/** * Get a mangled name for a type * * @param type Type to get mangled name for * @return Mangled name for type */ public String getMangledName(TypeDescription type) { return type.getCanonicalName().replace('.', '/'); }
/** * Get a mangled name for a type * * @param type Type to get mangled name for * @return Mangled name for type */ public String getMangledName(TypeDescription type) { return type.getCanonicalName().replace('.', '/'); }
private boolean matches(AnnotationDescription foundAnnotation, Annotation supportedAnnotation) { String canonicalName = foundAnnotation.getAnnotationType().getCanonicalName(); return supportedAnnotation.partialClassNames() .stream() .anyMatch(canonicalName::endsWith); } }
private void cacheSupportedAnnotations( AnnotationDescription annotation, Set<Class<?>> types, AnnotationCache cache, Consumer<Annotation> addToCache, boolean inheriting) { if (ignoredAnnotations.contains(annotation.getAnnotationType().getCanonicalName())) { return; } Consumer<Annotation> postProcess = a -> a.postProcess(types, cache); AnnotationProperties props = buildAnnotationProperties(annotation); supportedAnnotations .stream() .filter(sa -> matches(annotation, sa)) .filter(sa -> !inheriting || sa.inherits()) .filter(sa -> sa.validate(props, cache, ignoredAnnotations)) .forEach(addToCache.andThen(postProcess)); }
private AnnotationProperties buildAnnotationProperties(AnnotationDescription annotation) { AnnotationProperties props = new AnnotationProperties(annotation.getAnnotationType().getCanonicalName()); annotation.getAnnotationType().getDeclaredMethods().forEach(m -> { Object val = annotation.getValue(m).resolve(); if (val.getClass().isArray() && !val.getClass().getComponentType().isPrimitive()) { Object[] array = (Object[])val; Set<String> values = new HashSet<>(); for (Object obj : array) { if (obj instanceof TypeDescription) { values.add(((TypeDescription)obj).getName()); } else { values.add(obj.toString()); } } props.putArrayValues(m.getName(), values); } }); return props; }