com.cryptomorin.xseries.reflection.jvm.MemberHandle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of XSeries Show documentation
Show all versions of XSeries Show documentation
A set of utilities for Minecraft plugins
package com.cryptomorin.xseries.reflection.jvm;
import com.cryptomorin.xseries.reflection.Handle;
import com.cryptomorin.xseries.reflection.jvm.classes.ClassHandle;
import org.intellij.lang.annotations.Language;
import java.lang.invoke.MethodHandle;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Member;
public abstract class MemberHandle implements Handle {
protected boolean makeAccessible, isFinal;
protected final ClassHandle clazz;
protected MemberHandle(ClassHandle clazz) {this.clazz = clazz;}
public ClassHandle getClassHandle() {
return clazz;
}
public MemberHandle makeAccessible() {
this.makeAccessible = true;
return this;
}
public abstract MemberHandle signature(@Language("Java") String declaration);
public abstract MethodHandle reflect() throws ReflectiveOperationException;
public abstract T reflectJvm() throws ReflectiveOperationException;
protected T handleAccessible(T accessibleObject) throws ReflectiveOperationException {
if (this.makeAccessible) accessibleObject.setAccessible(true);
return accessibleObject;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy