| // |
| // Licensed to the Apache Software Foundation (ASF) under one |
| // or more contributor license agreements. See the NOTICE file |
| // distributed with this work for additional information |
| // regarding copyright ownership. The ASF licenses this file |
| // to you under the Apache License, Version 2.0 (the |
| // "License"); you may not use this file except in compliance |
| // with the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, |
| // software distributed under the License is distributed on an |
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| // KIND, either express or implied. See the License for the |
| // specific language governing permissions and limitations |
| // under the License. |
| // |
| |
| = DevFaqFolderOfInstances |
| :jbake-type: wiki |
| :jbake-tags: wiki, devfaq, needsreview |
| :jbake-status: published |
| :keywords: Apache NetBeans wiki DevFaqFolderOfInstances |
| :description: Apache NetBeans wiki DevFaqFolderOfInstances |
| :toc: left |
| :toc-title: |
| :syntax: true |
| |
| === 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 link:DevFaqSystemFilesystem.asciidoc[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: |
| |
| [source,java] |
| ---- |
| |
| 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, link:DevFaqFindInstance.asciidoc[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 link:http://wiki.netbeans.org/DevFaqFolderOfInstances[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-02-07, and needs to be reviewed. |