@Target(value={FIELD,METHOD})
@Retention(value=RUNTIME)
public @interface Listener
| Modifier and Type | Required Element and Description |
|---|---|
java.lang.String |
value
The name of the setting this listener is listening for.
|
public abstract java.lang.String value
Note that this must be equal to the resolved name of the setting: if you have specified a naming convention for your settings, or you have set a custom name for the setting, this value must be equal to the name of the setting you're listening for after that naming convention was applied!
For example, if you are using snake_case:
@Settings(namingConvention = UnderscoredLowerCaseConvention.class)
class MySettings {
private int fooBar = 5;
@Listener("foo_bar") // foo_bar not fooBar
public void fooBarListener(int newValue) {
System.out.println("Changed to " + newValue);
}
}