package com.google.common.reflect; import com.google.common.base.Preconditions; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; import com.google.common.collect.UnmodifiableIterator; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import javax.annotation.CheckForNull; @ElementTypesAreNonnullByDefault /* loaded from: classes3.dex */ public final class Parameter implements AnnotatedElement { private final ImmutableList annotations; private final Invokable declaration; private final int position; private final TypeToken type; public Invokable getDeclaringInvokable() { return this.declaration; } public TypeToken getType() { return this.type; } public int hashCode() { return this.position; } /* JADX INFO: Access modifiers changed from: package-private */ public Parameter(Invokable invokable, int i, TypeToken typeToken, Annotation[] annotationArr) { this.declaration = invokable; this.position = i; this.type = typeToken; this.annotations = ImmutableList.copyOf(annotationArr); } @Override // java.lang.reflect.AnnotatedElement public boolean isAnnotationPresent(Class cls) { return getAnnotation(cls) != null; } @Override // java.lang.reflect.AnnotatedElement @CheckForNull public A getAnnotation(Class cls) { Preconditions.checkNotNull(cls); UnmodifiableIterator it = this.annotations.iterator(); while (it.hasNext()) { Annotation next = it.next(); if (cls.isInstance(next)) { return cls.cast(next); } } return null; } @Override // java.lang.reflect.AnnotatedElement public Annotation[] getAnnotations() { return getDeclaredAnnotations(); } @Override // java.lang.reflect.AnnotatedElement public A[] getAnnotationsByType(Class cls) { return (A[]) getDeclaredAnnotationsByType(cls); } @Override // java.lang.reflect.AnnotatedElement public Annotation[] getDeclaredAnnotations() { return (Annotation[]) this.annotations.toArray(new Annotation[0]); } @Override // java.lang.reflect.AnnotatedElement @CheckForNull public A getDeclaredAnnotation(Class cls) { Preconditions.checkNotNull(cls); return (A) FluentIterable.from(this.annotations).filter(cls).first().orNull(); } @Override // java.lang.reflect.AnnotatedElement public A[] getDeclaredAnnotationsByType(Class cls) { return (A[]) ((Annotation[]) FluentIterable.from(this.annotations).filter(cls).toArray(cls)); } public boolean equals(@CheckForNull Object obj) { if (!(obj instanceof Parameter)) { return false; } Parameter parameter = (Parameter) obj; return this.position == parameter.position && this.declaration.equals(parameter.declaration); } public String toString() { String valueOf = String.valueOf(this.type); return new StringBuilder(String.valueOf(valueOf).length() + 15).append(valueOf).append(" arg").append(this.position).toString(); } }