136 lines
4.0 KiB
Java
136 lines
4.0 KiB
Java
|
package com.google.common.reflect;
|
||
|
|
||
|
import com.google.common.base.Preconditions;
|
||
|
import java.lang.annotation.Annotation;
|
||
|
import java.lang.reflect.AccessibleObject;
|
||
|
import java.lang.reflect.Member;
|
||
|
import java.lang.reflect.Modifier;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class Element extends AccessibleObject implements Member {
|
||
|
private final AccessibleObject accessibleObject;
|
||
|
private final Member member;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public <M extends AccessibleObject & Member> Element(M m) {
|
||
|
Preconditions.checkNotNull(m);
|
||
|
this.accessibleObject = m;
|
||
|
this.member = m;
|
||
|
}
|
||
|
|
||
|
public TypeToken<?> getOwnerType() {
|
||
|
return TypeToken.of((Class) getDeclaringClass());
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.reflect.AccessibleObject, java.lang.reflect.AnnotatedElement
|
||
|
public final boolean isAnnotationPresent(Class<? extends Annotation> cls) {
|
||
|
return this.accessibleObject.isAnnotationPresent(cls);
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.reflect.AccessibleObject, java.lang.reflect.AnnotatedElement
|
||
|
public final <A extends Annotation> A getAnnotation(Class<A> cls) {
|
||
|
return (A) this.accessibleObject.getAnnotation(cls);
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.reflect.AccessibleObject, java.lang.reflect.AnnotatedElement
|
||
|
public final Annotation[] getAnnotations() {
|
||
|
return this.accessibleObject.getAnnotations();
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.reflect.AccessibleObject, java.lang.reflect.AnnotatedElement
|
||
|
public final Annotation[] getDeclaredAnnotations() {
|
||
|
return this.accessibleObject.getDeclaredAnnotations();
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.reflect.AccessibleObject
|
||
|
public final void setAccessible(boolean z) throws SecurityException {
|
||
|
this.accessibleObject.setAccessible(z);
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.reflect.AccessibleObject
|
||
|
public final boolean isAccessible() {
|
||
|
return this.accessibleObject.isAccessible();
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.reflect.Member
|
||
|
public Class<?> getDeclaringClass() {
|
||
|
return this.member.getDeclaringClass();
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.reflect.Member
|
||
|
public final String getName() {
|
||
|
return this.member.getName();
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.reflect.Member
|
||
|
public final int getModifiers() {
|
||
|
return this.member.getModifiers();
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.reflect.Member
|
||
|
public final boolean isSynthetic() {
|
||
|
return this.member.isSynthetic();
|
||
|
}
|
||
|
|
||
|
public final boolean isPublic() {
|
||
|
return Modifier.isPublic(getModifiers());
|
||
|
}
|
||
|
|
||
|
public final boolean isProtected() {
|
||
|
return Modifier.isProtected(getModifiers());
|
||
|
}
|
||
|
|
||
|
public final boolean isPackagePrivate() {
|
||
|
return (isPrivate() || isPublic() || isProtected()) ? false : true;
|
||
|
}
|
||
|
|
||
|
public final boolean isPrivate() {
|
||
|
return Modifier.isPrivate(getModifiers());
|
||
|
}
|
||
|
|
||
|
public final boolean isStatic() {
|
||
|
return Modifier.isStatic(getModifiers());
|
||
|
}
|
||
|
|
||
|
public final boolean isFinal() {
|
||
|
return Modifier.isFinal(getModifiers());
|
||
|
}
|
||
|
|
||
|
public final boolean isAbstract() {
|
||
|
return Modifier.isAbstract(getModifiers());
|
||
|
}
|
||
|
|
||
|
public final boolean isNative() {
|
||
|
return Modifier.isNative(getModifiers());
|
||
|
}
|
||
|
|
||
|
public final boolean isSynchronized() {
|
||
|
return Modifier.isSynchronized(getModifiers());
|
||
|
}
|
||
|
|
||
|
final boolean isVolatile() {
|
||
|
return Modifier.isVolatile(getModifiers());
|
||
|
}
|
||
|
|
||
|
final boolean isTransient() {
|
||
|
return Modifier.isTransient(getModifiers());
|
||
|
}
|
||
|
|
||
|
public boolean equals(Object obj) {
|
||
|
if (!(obj instanceof Element)) {
|
||
|
return false;
|
||
|
}
|
||
|
Element element = (Element) obj;
|
||
|
return getOwnerType().equals(element.getOwnerType()) && this.member.equals(element.member);
|
||
|
}
|
||
|
|
||
|
public int hashCode() {
|
||
|
return this.member.hashCode();
|
||
|
}
|
||
|
|
||
|
public String toString() {
|
||
|
return this.member.toString();
|
||
|
}
|
||
|
}
|