/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo}: * <p> * {@code new Key<Foo>() {}}. */ @SuppressWarnings("unchecked") protected Key() { this.annotationStrategy = NullAnnotationStrategy.INSTANCE; this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo} annotated with * {@code @Bar}: * <p> * {@code new Key<Foo>(new Bar()) {}}. */ @SuppressWarnings("unchecked") protected Key(Annotation annotation) { // no usages, not test-covered this.annotationStrategy = strategyFor(annotation); this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo} annotated with * {@code @Bar}: * <p> * {@code new Key<Foo>(Bar.class) {}}. */ @SuppressWarnings("unchecked") protected Key(Class<? extends Annotation> annotationType) { this.annotationStrategy = strategyFor(annotationType); this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo}: * <p> * {@code new Key<Foo>() {}}. */ @SuppressWarnings("unchecked") protected Key() { this.annotationStrategy = NullAnnotationStrategy.INSTANCE; this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo}: * <p> * {@code new Key<Foo>() {}}. */ @SuppressWarnings("unchecked") protected Key() { this.annotationStrategy = NullAnnotationStrategy.INSTANCE; this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo}: * <p> * {@code new Key<Foo>() {}}. */ @SuppressWarnings("unchecked") protected Key() { this.annotationStrategy = NullAnnotationStrategy.INSTANCE; this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo}: * <p> * {@code new Key<Foo>() {}}. */ @SuppressWarnings("unchecked") protected Key() { this.annotationStrategy = NullAnnotationStrategy.INSTANCE; this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo} annotated with * {@code @Bar}: * <p> * {@code new Key<Foo>(Bar.class) {}}. */ @SuppressWarnings("unchecked") protected Key(Class<? extends Annotation> annotationType) { this.annotationStrategy = strategyFor(annotationType); this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo} annotated with * {@code @Bar}: * <p> * {@code new Key<Foo>(Bar.class) {}}. */ @SuppressWarnings("unchecked") protected Key(Class<? extends Annotation> annotationType) { this.annotationStrategy = strategyFor(annotationType); this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo} annotated with * {@code @Bar}: * <p> * {@code new Key<Foo>(Bar.class) {}}. */ @SuppressWarnings("unchecked") protected Key(Class<? extends Annotation> annotationType) { this.annotationStrategy = strategyFor(annotationType); this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo} annotated with * {@code @Bar}: * <p> * {@code new Key<Foo>(new Bar()) {}}. */ @SuppressWarnings("unchecked") protected Key(Annotation annotation) { // no usages, not test-covered this.annotationStrategy = strategyFor(annotation); this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo} annotated with * {@code @Bar}: * <p> * {@code new Key<Foo>(new Bar()) {}}. */ @SuppressWarnings("unchecked") protected Key(Annotation annotation) { // no usages, not test-covered this.annotationStrategy = strategyFor(annotation); this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo} annotated with * {@code @Bar}: * <p> * {@code new Key<Foo>(new Bar()) {}}. */ @SuppressWarnings("unchecked") protected Key(Annotation annotation) { // no usages, not test-covered this.annotationStrategy = strategyFor(annotation); this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo} annotated with * {@code @Bar}: * <p> * {@code new Key<Foo>(Bar.class) {}}. */ @SuppressWarnings("unchecked") protected Key(Class<? extends Annotation> annotationType) { this.annotationStrategy = strategyFor(annotationType); this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }
/** * Constructs a new key. Derives the type from this class's type parameter. * <p> * Clients create an empty anonymous subclass. Doing so embeds the type * parameter in the anonymous class's type hierarchy so we can reconstitute it * at runtime despite erasure. * <p> * Example usage for a binding of type {@code Foo} annotated with * {@code @Bar}: * <p> * {@code new Key<Foo>(new Bar()) {}}. */ @SuppressWarnings("unchecked") protected Key(Annotation annotation) { // no usages, not test-covered this.annotationStrategy = strategyFor(annotation); this.typeLiteral = (TypeLiteral<T>) TypeLiteral.fromSuperclassTypeParameter(getClass()); this.hashCode = computeHashCode(); }