}
}
+ public static ConcreteType typeForClass(final Class<?> cls, final Restrictions restrictions,
+ final ModuleContext moduleContext) {
+ if (restrictions != null) {
+ if (restrictions instanceof DefaultRestrictions) {
+ return new ConcreteTypeImpl(cls.getPackage().getName(), cls.getSimpleName(), restrictions);
+ } else {
+ return new BaseTypeWithRestrictionsImpl(cls.getPackage().getName(), cls.getSimpleName(), restrictions,
+ moduleContext);
+ }
+ } else {
+ return typeForClass(cls);
+ }
+ }
+
/**
* Returns an instance of {@link ParameterizedType} describing the typed
* {@link Map}<K,V>
this.restrictions = Preconditions.checkNotNull(restrictions);
}
+ private BaseTypeWithRestrictionsImpl(final String pkName, final String name, final Restrictions restrictions,
+ final ModuleContext moduleContext) {
+ super(pkName, name, moduleContext);
+ this.restrictions = Preconditions.checkNotNull(restrictions);
+ }
+
@Override
public Restrictions getRestrictions() {
return this.restrictions;