public static Iterable<ApplicationEvent> events( Iterable<TransactionApplicationEvents> transactions ) { List<Iterable<ApplicationEvent>> events = new ArrayList<Iterable<ApplicationEvent>>(); for (TransactionApplicationEvents transactionDomain : transactions) { events.add( transactionDomain.events().get() ); } Iterable<ApplicationEvent>[] iterables = (Iterable<ApplicationEvent>[]) new Iterable[events.size()]; return Iterables.flatten( events.<Iterable<ApplicationEvent>>toArray( iterables ) ); }
public static Iterable<Annotation> findAccessorAndTypeAnnotationsIn( AccessibleObject accessor ) { return flatten( iterable( accessor.getAnnotations() ), flattenIterables( map( Annotations.ANNOTATIONS_OF, interfacesOf( typeOf( accessor ) ) ) ) ); } }
@Override public Iterable<Type> map( Type type ) { Class clazz = RAW_CLASS.map( type ); if( clazz.isInterface() ) { Iterable<Type> genericInterfaces = iterable( clazz.getGenericInterfaces() ); Iterable<Type> flattenIterables = flattenIterables( Iterables.map( INTERFACES_OF, genericInterfaces ) ); return prepend( clazz, flattenIterables ); } else { return flatten( CLASS_HIERARCHY.map( type ), flattenIterables( Iterables.map( INTERFACES_OF, CLASS_HIERARCHY.map( type ) ) ) ); } } };
public static Iterable<ApplicationEvent> events( TransactionApplicationEvents... transactionDomains ) { List<Iterable<ApplicationEvent>> events = new ArrayList<Iterable<ApplicationEvent>>(); for (TransactionApplicationEvents transactionDomain : transactionDomains) { events.add( transactionDomain.events().get() ); } Iterable<ApplicationEvent>[] iterables = (Iterable<ApplicationEvent>[]) new Iterable[events.size()]; return Iterables.flatten( events.<Iterable<ApplicationEvent>>toArray( iterables ) ); }
@Override public Iterable<Type> map( Type type ) { Class clazz = RAW_CLASS.map( type ); if( clazz.isInterface() ) { Iterable<Type> genericInterfaces = iterable( clazz.getGenericInterfaces() ); Iterable<Type> flattenIterables = flattenIterables( Iterables.map( INTERFACES_OF, genericInterfaces ) ); return prepend( type, flattenIterables ); } else { if( type.equals( Object.class ) ) { return iterable( clazz.getGenericInterfaces() ); } else { return flatten( flattenIterables( Iterables.map( INTERFACES_OF, iterable( clazz.getGenericInterfaces() ) ) ), INTERFACES_OF.map( RAW_CLASS.map( type ).getSuperclass() ) ); } } } };
public static Iterable<Type> typesOf( Iterable<Type> types ) { Iterable<Type> result = empty(); for( Type type : types ) { result = flatten( result, typesOf( type ) ); } return result; }
public static Iterable<? extends Type> interfacesOf( Iterable<? extends Type> types ) { Iterable<Type> result = empty(); for( Type type : types ) { result = flatten( result, interfacesOf( type ) ); } return result; }