@ Inject @ SuppressWarnings ( "unchecked" ) public void setTypeLiteral ( TypeLiteral < T > clazz ) { if ( clazz == null ) throw new IllegalArgumentException ( "Cannot set null TypeLiteral on " + this ) ; if ( this . clazz != null && ! this . clazz . equals ( clazz . getRawType ( ) ) ) throw new IllegalStateException ( "Cannot call setTypeLiteral twice! Already has value " + this . clazz + ", will not overwrite with " + clazz . getRawType ( ) ) ; // Guice sets a Class<? super T> but we know we can cast to Class<T> by convention this . clazz = ( Class < T > ) clazz . getRawType ( ) ; isLargeTable = this . clazz . isAnnotationPresent ( LargeTable . class ) ; }
Called by guice to provide the Class associated with T