/** * Creates a deterministic signature for a {@link Constructor}. * * @param constructor The constructor to generate the signature for * @param annotations The annotations to include in the signature * @param parameters The {@link AnnotatedParameter}s to include in the * signature */ public static <X> String createConstructorId(Constructor<X> constructor, Set<Annotation> annotations, List<AnnotatedParameter<X>> parameters) { StringBuilder builder = new StringBuilder(); builder.append(constructor.getDeclaringClass().getName()); builder.append('.'); builder.append(constructor.getName()); builder.append(createAnnotationCollectionId(annotations)); builder.append(createParameterListId(parameters)); return builder.toString(); }
/** * Creates a deterministic signature for a {@link Method}. * * @param method The method to generate the signature for * @param annotations The annotations to include in the signature * @param parameters The {@link AnnotatedParameter}s to include in the * signature */ public static <X> String createMethodId(Method method, Set<Annotation> annotations, List<AnnotatedParameter<X>> parameters) { StringBuilder builder = new StringBuilder(); builder.append(method.getDeclaringClass().getName()); builder.append('.'); builder.append(method.getName()); builder.append(createAnnotationCollectionId(annotations)); builder.append(createParameterListId(parameters)); return builder.toString(); }
/** * Generates a deterministic signature for an {@link AnnotatedCallable}. Two * <code>AnnotatedCallable</code>s that have the same annotations and * underlying callable will generate the same signature. */ public static <X> String createCallableId(AnnotatedCallable<X> method) { StringBuilder builder = new StringBuilder(); builder.append(method.getJavaMember().getDeclaringClass().getName()); builder.append('.'); builder.append(method.getJavaMember().getName()); builder.append(createAnnotationCollectionId(method.getAnnotations())); builder.append(createParameterListId(method.getParameters())); return builder.toString(); }