In my project I want quickly read from and make modifications to a private-ish variable. I was initially going to do reflection, but my thinking was that it would be too inefficient.
public class SomeControllerInALibraryThatICantEdit {
//I can easily get an instance of the controller
public static final SomeControllerInLargeLibrary instance;
//I need to read from and make changes to the data object quickly.
//It is final, so I don't need to worry about this object changing or being reset.
private final Subclass dataClass = new Subclass();
private class Subclass {
//I can get this once then treat it like any other array.
public float[] arr;
//This is the problematic part. I need to be able to quickly check changes and
//set this every update. Keeping in mind there are multiple dataPoints.
public short dataPoint;
}
}
What is a quick and efficient way to get and set dataPoint? I can use reflection, but I am hoping there is a better way to approach this problem. Can I in some way make a Pojo that represents Subclass and link their pointers together?
If I just fork the library and make it work better with what I am doing, then that defeats the purpose of my project.
Aucun commentaire:
Enregistrer un commentaire