Let\'s say I have a class with a string field named \"myfield\", and use reflection to get the field, I\'ve found that Object.getClass().getDeclaredField(\"myfield\");
Object.getClass().getDeclaredField(\"myfield\");
No, there's no such way. You can get all fields and search through them:
Field[] fields = src.getClass().getDeclaredFields(); for(Field f:fields){ if(f.getName().equalsIgnoreCase("myfield")){ //stuff. } }