Parameter.java 3.21 KB
package com.google.common.reflect;

import com.google.common.annotations.Beta;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.util.Iterator;
import javax.annotation.Nullable;

@Beta
public final class Parameter
  implements AnnotatedElement
{
  private final Invokable<?, ?> a;
  private final int b;
  private final TypeToken<?> c;
  private final ImmutableList<Annotation> d;
  
  Parameter(Invokable<?, ?> paramInvokable, int paramInt, TypeToken<?> paramTypeToken, Annotation[] paramArrayOfAnnotation)
  {
    this.a = paramInvokable;
    this.b = paramInt;
    this.c = paramTypeToken;
    this.d = ImmutableList.copyOf(paramArrayOfAnnotation);
  }
  
  public final boolean equals(@Nullable Object paramObject)
  {
    boolean bool2 = false;
    boolean bool1 = bool2;
    if ((paramObject instanceof Parameter))
    {
      paramObject = (Parameter)paramObject;
      bool1 = bool2;
      if (this.b == ((Parameter)paramObject).b)
      {
        bool1 = bool2;
        if (this.a.equals(((Parameter)paramObject).a)) {
          bool1 = true;
        }
      }
    }
    return bool1;
  }
  
  @Nullable
  public final <A extends Annotation> A getAnnotation(Class<A> paramClass)
  {
    Preconditions.checkNotNull(paramClass);
    Iterator localIterator = this.d.iterator();
    while (localIterator.hasNext())
    {
      Annotation localAnnotation = (Annotation)localIterator.next();
      if (paramClass.isInstance(localAnnotation)) {
        return (Annotation)paramClass.cast(localAnnotation);
      }
    }
    return null;
  }
  
  public final Annotation[] getAnnotations()
  {
    return getDeclaredAnnotations();
  }
  
  public final <A extends Annotation> A[] getAnnotationsByType(Class<A> paramClass)
  {
    return getDeclaredAnnotationsByType(paramClass);
  }
  
  @Nullable
  public final <A extends Annotation> A getDeclaredAnnotation(Class<A> paramClass)
  {
    Preconditions.checkNotNull(paramClass);
    return (Annotation)FluentIterable.from(this.d).filter(paramClass).first().orNull();
  }
  
  public final Annotation[] getDeclaredAnnotations()
  {
    return (Annotation[])this.d.toArray(new Annotation[this.d.size()]);
  }
  
  public final <A extends Annotation> A[] getDeclaredAnnotationsByType(Class<A> paramClass)
  {
    return (Annotation[])FluentIterable.from(this.d).filter(paramClass).toArray(paramClass);
  }
  
  public final Invokable<?, ?> getDeclaringInvokable()
  {
    return this.a;
  }
  
  public final TypeToken<?> getType()
  {
    return this.c;
  }
  
  public final int hashCode()
  {
    return this.b;
  }
  
  public final boolean isAnnotationPresent(Class<? extends Annotation> paramClass)
  {
    return getAnnotation(paramClass) != null;
  }
  
  public final String toString()
  {
    String str = String.valueOf(String.valueOf(this.c));
    int i = this.b;
    return str.length() + 15 + str + " arg" + i;
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/reflect/Parameter.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */