View Javadoc

1   package com.lexicalscope.fluentreflection;
2   
3   import static ch.lambdaj.Lambda.convert;
4   import static java.util.Collections.unmodifiableList;
5   
6   import java.util.List;
7   
8   import com.google.inject.TypeLiteral;
9   
10  final class ReflectedConstructorsImpl<T> implements ReflectedConstructors<T> {
11      private final ReflectedTypeFactory reflectedTypeFactory;
12      private final TypeLiteral<T> typeLiteral;
13  
14      public ReflectedConstructorsImpl(final ReflectedTypeFactory reflectedTypeFactory, final TypeLiteral<T> typeLiteral) {
15          this.reflectedTypeFactory = reflectedTypeFactory;
16          this.typeLiteral = typeLiteral;
17      }
18  
19      @Override public List<FluentConstructor<T>> constructors() {
20          return unmodifiableList(convert(
21                  typeLiteral.getRawType().getConstructors(),
22                  new ConvertConstructorToReflectedConstructor<T>(
23                          reflectedTypeFactory, typeLiteral)));
24      }
25  }