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; /* loaded from: classes2.dex */ public final class Parameter implements AnnotatedElement { private final ImmutableList annotations; private final Invokable declaration; private final int position; private final TypeToken type; /* 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 final boolean isAnnotationPresent(Class cls) { return getAnnotation(cls) != null; } @Override // java.lang.reflect.AnnotatedElement public final 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 final Annotation[] getAnnotations() { return getDeclaredAnnotations(); } @Override // java.lang.reflect.AnnotatedElement public final A[] getAnnotationsByType(Class cls) { return (A[]) getDeclaredAnnotationsByType(cls); } @Override // java.lang.reflect.AnnotatedElement public final Annotation[] getDeclaredAnnotations() { return (Annotation[]) this.annotations.toArray(new Annotation[0]); } @Override // java.lang.reflect.AnnotatedElement public final A getDeclaredAnnotation(Class cls) { Preconditions.checkNotNull(cls); return (A) FluentIterable.from(this.annotations).filter(cls).first().orNull(); } @Override // java.lang.reflect.AnnotatedElement public final A[] getDeclaredAnnotationsByType(Class cls) { return (A[]) ((Annotation[]) FluentIterable.from(this.annotations).filter(cls).toArray(cls)); } public final boolean equals(Object obj) { if (!(obj instanceof Parameter)) { return false; } Parameter parameter = (Parameter) obj; return this.position == parameter.position && this.declaration.equals(parameter.declaration); } public final String toString() { String valueOf = String.valueOf(this.type); int i = this.position; StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 15); sb.append(valueOf); sb.append(" arg"); sb.append(i); return sb.toString(); } public final int hashCode() { return this.position; } public final TypeToken getType() { return this.type; } public final Invokable getDeclaringInvokable() { return this.declaration; } }