is it possible to change the value of an attribute of a class using reflection.
below is my class :-
public class LoggerManager {
private static LoggerManager _instance = new LoggerManager();
private LoggerManager() {
}
public static LoggerManager getInstance() {
return _instance;
}
public Logger getLogger(String FQCN) {
Logger logger = Logger.getLogger(FQCN);
logger.setLevel(Level.INFO);
return logger;
}
}
i want to change the value of _instance
variable using reflection..
basically i want to change the value of the same to _instance = new NewLoggerManager();
,
provided that NewLoggerManager extends LoggerManager
is it possible to do so, as i know how to invoke methods, but how to do this one.. ???