All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cryptomorin.xseries.reflection.jvm.MemberHandle Maven / Gradle / Ivy

There is a newer version: 12.1.0
Show newest version
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