Skip to content

DevFaqWaysToRegisterInDefaultLookup

Antonio Vieiro edited this page Jan 25, 2018 · 1 revision

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

Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.

This page was exported from http://wiki.netbeans.org/DevFaqWaysToRegisterInDefaultLookup , that was last modified by NetBeans user Jglick on 2010-06-14T22:28:44Z.

NOTE: This document was automatically converted to the AsciiDoc format on 2018-01-26, and needs to be reviewed.

Clone this wiki locally