@Override public <T> Iterable<T> convert( final Class<T> valueType, Iterable<Object> entities ) { return Iterables.map( new Function<Object, T>() { @Override public T map( Object entity ) { return convert( valueType, entity ); } }, entities ); }
@Override public <T> Iterable<T> convert( final Class<T> valueType, Iterable<Object> entities, final Function<T, T> prototypeOpportunity ) { return Iterables.map( new Function<Object, T>() { @Override public T map( Object entity ) { return convert( valueType, entity, prototypeOpportunity ); } }, entities ); }
@Override public <T> Iterable<T> create( final Class<T> entityType, final Iterable<Object> values ) { return Iterables.map( new Function<Object, T>() { @Override public T map( Object value ) { return create( entityType, value ); } }, values ); }
@Override public <T> Iterable<T> create( final Class<T> entityType, final Iterable<Object> values, final Function<T, T> prototypeOpportunity ) { return Iterables.map( new Function<Object, T>() { @Override public T map( Object value ) { return create( entityType, value, prototypeOpportunity ); } }, values ); }
public static Iterable<DomainEventValue> events( Iterable<UnitOfWorkDomainEventsValue> transactions ) { return Iterables.flattenIterables( Iterables.map( new Function<UnitOfWorkDomainEventsValue, Iterable<DomainEventValue>>() { @Override public Iterable<DomainEventValue> map( UnitOfWorkDomainEventsValue unitOfWorkDomainEventsValue ) { return unitOfWorkDomainEventsValue.events().get(); } }, transactions ) ); }
@Override public <U> DataSet<U> project( Function<T, U> conversion ) { return new IterableDataSet<U>( Iterables.map( conversion, iterable ) ); }
@Override public Iterable<T> map( Type type ) { return flattenIterables( Iterables.map( function, CLASS_HIERARCHY.map( type ) ) ); } };
@Override public Iterable<T> map( Type type ) { return flattenIterables( Iterables.map( function, TYPES_OF.map( type ) ) ); } };
@Override public TemplateCollectionModel keys() throws TemplateModelException { return (TemplateCollectionModel) wrapper.wrap( Iterables.map( new Function<PropertyDescriptor, String>() { @Override public String map( PropertyDescriptor propertyDescriptor ) { return propertyDescriptor.qualifiedName().name(); } }, descriptor.state().properties() ).iterator() ); }
private static String toString( Class<?>[] mixinTypes ) Iterable<String> map = Iterables.map( new Function<Class<?>, String>()
@Override public boolean satisfiedBy( ModelDescriptor item ) { return matchesAny( new Specification<String>() { @Override public boolean satisfiedBy( String item ) { return item.equals( className ); } }, map( new Function<Class<?>, String>() { @Override public String map( Class<?> item ) { return item.getName(); } }, item.types() ) ); } };
public static Specification<DomainEventValue> withNames( final Class eventClass ) { return Events.withNames( map( new Function<Method, String>() { @Override public String map( Method method ) { return method.getName(); } }, Iterables.toList( Methods.METHODS_OF.map( eventClass ) ) )); }
public static Specification<ApplicationEvent> withNames( final Class eventClass ) { return ApplicationEvents.withNames( Iterables.map( new Function<Method, String>() { @Override public String map( Method method ) { return method.getName(); } }, Iterables.toList( Methods.METHODS_OF.map( eventClass ) ) )); }
@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() ) ); } } } };
@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<Annotation> findAccessorAndTypeAnnotationsIn( AccessibleObject accessor ) { return flatten( iterable( accessor.getAnnotations() ), flattenIterables( map( Annotations.ANNOTATIONS_OF, interfacesOf( typeOf( accessor ) ) ) ) ); } }
@Override public T importService( final ImportedServiceDescriptor serviceDescriptor ) throws ServiceImporterException { T instance = null; Iterable<MetaInfoHolder> holders = Iterables.iterable( serviceDescriptor, module, layer, application ); for( final MetaInfoHolder metaInfoHolder : holders ) { Function<Class<?>, T> metaFinder = new Function<Class<?>, T>() { @Override @SuppressWarnings( "unchecked" ) public T map( Class<?> type ) { return (T) metaInfoHolder.metaInfo( type ); } }; instance = first( filter( notNull(), map( metaFinder, serviceDescriptor.types() ) ) ); if( instance != null ) { break; } } return instance; }
private <T> EntityBuilder<?> doConversion( Class<T> entityType, String identity, Object value ) { EntityDescriptor eDesc = module.entityDescriptor( entityType.getName() ); if( eDesc == null ) { throw new EntityTypeNotFoundException( entityType.getName(), module.name(), map( ModelModule.toStringFunction, module.findVisibleEntityTypes() ) ); } ValueComposite vComposite = (ValueComposite) value; ValueDescriptor vDesc = spi.valueDescriptorFor( vComposite ); AssociationStateHolder vState = spi.stateOf( vComposite ); AssociationStateDescriptor vStateDesc = vDesc.state(); Unqualified unqualified = vDesc.metaInfo( Unqualified.class ); if( unqualified == null || !unqualified.value() ) { return doQualifiedConversion( entityType, identity, vState, vStateDesc ); } return doUnqualifiedConversion( entityType, identity, vState, vStateDesc ); }