As far as I know, there is no way to know about your "child classes" in Java reflectively. Wouldn't a better solution be to create an abstract method on A that B would have to implement, and call that instead?
public class A {
//other stuff here
protected void abstract mySubMethod();
//other stuff here
}
Edit:
If I have misunderstood your question, and you actually want to know about parent classes, then yes: getDeclaredFields() is the correct reflective method to use, as mentioned by other posters.
Additional Edit:
I hate to keep modifying this answer, but...
In general, if you are attempting to give access to a parent class, the "correct" and "future proof" way to do this is to create abstract methods that are getters or setters (or even more complex, if necessary) and then have the children honor those or not, and respond as appropriate.
That being said, you can do something like the others have said:
getClass().getParentClass().getDeclaredFields()
However, that would only work if C is always directly inherited from B. Reflections is, by it's very nature, tricky and specific. I have to do a LOT of it on a project I am on (don't ask, trust me, you DON'T want to know), and I avoid it whenever possible. Unless there is a good reason for A to need the protected fields and it is discovering information about them, then you would likely want to use an abstract method. I would also submit that it is likely that you can solve the other problem with an abstract method, however it might be a little bit harder.