I have a class with various variables
public class myClass{ public int id; public String category; public String description; public String star
As others already mentioned reflection is what you need.
If you need to access a private field you can use Class.getDeclaredField(String name)
Class.getDeclaredField(String name)