Wiki
Clone wikiWorld Politics / Initialization
Overview
The initialization plug-in helps ensure that no null
values are accidentally dereferenced in the system.
Usage
Consider the following code:
@Initialize public class Test { private Set set; public Test() { System.out.println( "Set is empty = " + getSet().isEmpty() ); } protected Set createSet() { return new HashSet(); } }
The @Initialize
annotation ensures that the first usage of a variable (via its private get accessor method) initializes the variable to a known value.
Updated