DevFaqWaysToRegisterInDefaultLookup

Which Way Should I Use To Register an Object in the Default Lookup?

There are two ways to put something in the default Lookup:

What When to Use It How
Use the @ServiceProvider annotation Most of the time, unless you are building with Maven. This annotation relies on NetBeans' build infrastructure to generate flat files in META-INF/services described below, at compile time. Annotate your file with @ServiceProvider(service=Something.class)
Put an .instance file in your module layer in Services/Hidden Rarely - useful if you are making services available dynamically on the fly, for example when dynamically changing layer contents, or when specialized registration metadata or factory methods are needed Declare a .instance file, a .settings file or similar, or a .shadow file in your module's layer.xml file
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo