public static boolean compareAnnotatedTypes ( AnnotatedType < ? > t1 , AnnotatedType < ? > t2 ) { if ( ! t1 . getJavaClass ( ) . equals ( t2 . getJavaClass ( ) ) ) { return false ; } if ( ! compareAnnotated ( t1 , t2 ) ) { return false ; } if ( t1 . getFields ( ) . size ( ) != t2 . getFields ( ) . size ( ) ) { return false ; } Map < Field , AnnotatedField < ? > > fields = new HashMap < Field , AnnotatedField < ? > > ( ) ; for ( AnnotatedField < ? > f : t2 . getFields ( ) ) { fields . put ( f . getJavaMember ( ) , f ) ; } for ( AnnotatedField < ? > f : t1 . getFields ( ) ) { if ( fields . containsKey ( f . getJavaMember ( ) ) ) { if ( ! compareAnnotatedField ( f , fields . get ( f . getJavaMember ( ) ) ) ) { return false ; } } else { return false ; } } if ( t1 . getMethods ( ) . size ( ) != t2 . getMethods ( ) . size ( ) ) { return false ; } Map < Method , AnnotatedMethod < ? > > methods = new HashMap < Method , AnnotatedMethod < ? > > ( ) ; for ( AnnotatedMethod < ? > f : t2 . getMethods ( ) ) { methods . put ( f . getJavaMember ( ) , f ) ; } for ( AnnotatedMethod < ? > f : t1 . getMethods ( ) ) { if ( methods . containsKey ( f . getJavaMember ( ) ) ) { if ( ! compareAnnotatedCallable ( f , methods . get ( f . getJavaMember ( ) ) ) ) { return false ; } } else { return false ; } } if ( t1 . getConstructors ( ) . size ( ) != t2 . getConstructors ( ) . size ( ) ) { return false ; } Map < Constructor < ? > , AnnotatedConstructor < ? > > constructors = new HashMap < Constructor < ? > , AnnotatedConstructor < ? > > ( ) ; for ( AnnotatedConstructor < ? > f : t2 . getConstructors ( ) ) { constructors . put ( f . getJavaMember ( ) , f ) ; } for ( AnnotatedConstructor < ? > f : t1 . getConstructors ( ) ) { if ( constructors . containsKey ( f . getJavaMember ( ) ) ) { if ( ! compareAnnotatedCallable ( f , constructors . get ( f . getJavaMember ( ) ) ) ) { return false ; } } else { return false ; } } return true ; }
Compares two annotated types and returns true if they are the same