Skip to content

DevFaqFolderOfInstances

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

DevFaqFolderOfInstances

I have a folder full of .instance files. How do I get any/all of the object instances?

Often registries of objects are created by placing files with the extension .instance into some folder in the system filesystem. The task, then, is to turn a folder full of files into a collection of objects, and make sure we only get objects of the type we are interested in. In NetBeans 6 it is very simple to do that:

Lookup myObjects = Lookups.forPath ("path/to/folder/in/sysfs");
Collection <? extends MyType> c = myObjects.lookupAll(MyType.class);

(note the separator is always / with NetBeans filesystems).

If you have a single .instance file and need to get an object for that, see this FAQ entry.

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/DevFaqFolderOfInstances , that was last modified by NetBeans user Jtulach on 2010-07-24T19:43:48Z.

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

Clone this wiki locally