Java 类org.openide.util.SharedClassObject 实例源码

项目:incubator-netbeans    文件:FormatingTest.java   
@Override
protected void setUp() throws Exception {
    ClassPathProvider cpp = new ClassPathProvider() {

        @Override
        public ClassPath findClassPath(FileObject file, String type) {
            if (type.equals(ClassPath.SOURCE)) {
                return ClassPathSupport.createClassPath(new FileObject[]{FileUtil.toFileObject(getDataDir())});
            }
            if (type.equals(ClassPath.COMPILE)) {
                return ClassPathSupport.createClassPath(new FileObject[0]);
            }
            if (type.equals(ClassPath.BOOT)) {
                return createClassPath(System.getProperty("sun.boot.class.path"));
            }
            return null;
        }
    };
    SharedClassObject loader = JavaDataLoader.findObject(JavaDataLoader.class, true);
    SourceUtilsTestUtil.prepareTest(new String[]{"org/netbeans/modules/java/source/resources/layer.xml","org/netbeans/modules/java/source/base/layer.xml"}, new Object[]{loader/*, cpp*/});
    JEditorPane.registerEditorKitForContentType("text/x-java", "org.netbeans.modules.editor.java.JavaKit");
    File cacheFolder = new File(getWorkDir(), "var/cache/index");
    cacheFolder.mkdirs();
    IndexUtil.setCacheFolder(cacheFolder);
}
项目:incubator-netbeans    文件:NbInstaller.java   
public boolean closing(List<Module> modules) {
    Util.err.fine("closing: " + modules);
    for (Module m: modules) {
        Class<? extends ModuleInstall> instClazz = installs.get(m);
        if (instClazz != null) {
            try {
                ModuleInstall inst = SharedClassObject.findObject(instClazz, true);
                if (! inst.closing()) {
                    Util.err.fine("Module " + m + " refused to close");
                    return false;
                }
            } catch (RuntimeException re) {
                Util.err.log(Level.SEVERE, null, re);
                // continue, assume it is trash
            } catch (LinkageError le) {
                Util.err.log(Level.SEVERE, null, le);
            }
        }
    }
    return onStartStop.closing(modules);
}
项目:incubator-netbeans    文件:Activator.java   
private static ModuleInstall installerFor(Bundle b) {
    if (b.getSymbolicName().equals("org.netbeans.modules.autoupdate.ui")) { // NOI18N
        // Won't work anyway, so don't even try.
        return null;
    }
    String respath = (String) b.getHeaders().get("OpenIDE-Module-Install");
    if (respath != null) {
        String fqn = respath.replaceFirst("[.]class$", "").replace('/', '.');
        try {
            return SharedClassObject.findObject(((Class<?>) b.loadClass(fqn)).asSubclass(ModuleInstall.class), true);
        } catch (Exception x) { // CNFE, CCE, ...
            LOG.log(Level.WARNING, "Could not load " + fqn, x);
            return null;
        }
    }
    return null;
}
项目:studio    文件:AbstractFileSystem.java   
public SystemAction[] getActions () {
    if (!isEnabledRefreshFolder ()) {
        return NO_SYSTEM_ACTIONS;
    } else {
        if (SYSTEM_ACTIONS == null) {
            try {
                Class c = Class.forName ("org.openide.filesystems.RefreshAction"); // NOI18N
                RefreshAction ra = (RefreshAction) SharedClassObject.findObject (c, true);
                // initialize the SYSTEM_ACTIONS
                SYSTEM_ACTIONS = new SystemAction[] { ra };
            } catch (Exception ex) {
                // ok, we are probably running in standalone mode and
                // classes needed to initialize the RefreshAction are
                // not available
                SYSTEM_ACTIONS = NO_SYSTEM_ACTIONS;
            }
        }
        return SYSTEM_ACTIONS;
    }
}
项目:incubator-netbeans    文件:GeneratorTestMDRCompat.java   
@Override
protected void setUp() throws Exception {
    ClassPathProvider cpp = new ClassPathProvider() {
        public ClassPath findClassPath(FileObject file, String type) {
            if (type == ClassPath.SOURCE)
                return ClassPathSupport.createClassPath(getSourcePath());
                if (type == ClassPath.COMPILE)
                    return ClassPathSupport.createClassPath(new FileObject[0]);
                if (type == ClassPath.BOOT)
                    return createClassPath(System.getProperty("sun.boot.class.path"));
                return null;
        }
    };
    SharedClassObject loader = JavaDataLoader.findObject(JavaDataLoader.class, true);
    SourceLevelQueryImplementation slq = new SourceLevelQueryImplementation() {
        @Override public String getSourceLevel(FileObject javaFile) {
            return GeneratorTestMDRCompat.this.getSourceLevel();
        }
    };
    SourceUtilsTestUtil.prepareTest(new String[] {"org/netbeans/modules/java/source/resources/layer.xml"}, new Object[] {loader, cpp});
    MockMimeLookup.setInstances(MimePath.get("text/x-java"), new Reindenter.Factory());

    TestUtil.setupEditorMockServices();
    JEditorPane.registerEditorKitForContentType("text/x-java", "org.netbeans.modules.editor.java.JavaKit");
    File cacheFolder = new File(getWorkDir(), "var/cache/index");
    cacheFolder.mkdirs();
    IndexUtil.setCacheFolder(cacheFolder);
}
项目:incubator-netbeans    文件:GeneratorUtilitiesTest.java   
@Override
protected void setUp() throws Exception {
    SharedClassObject loader = JavaDataLoader.findObject(JavaDataLoader.class, true);
    SourceUtilsTestUtil.prepareTest(new String[]{"org/netbeans/modules/java/source/resources/layer.xml", "META-INF/generated-layer.xml"}, new Object[]{loader/*, cpp*/});
    JEditorPane.registerEditorKitForContentType("text/x-java", "org.netbeans.modules.editor.java.JavaKit");
    Main.initializeURLFactory();
}
项目:incubator-netbeans    文件:NbInstaller.java   
/** Load/unload installer code for a module. */
@SuppressWarnings("deprecation") // old ModuleInstall methods we have to call
private void loadCode(Module m, boolean load) throws Exception {
    Class<? extends ModuleInstall> instClazz = installs.get(m);
    if (instClazz != null) {
        ModuleInstall inst = SharedClassObject.findObject(instClazz, true);
        if (load) {
            ev.log(Events.RESTORE, m);
            inst.restored();
        } else {
            ev.log(Events.UNINSTALL, m);
            inst.uninstalled();
        }
    }
}
项目:incubator-netbeans    文件:NbInstaller.java   
@Override
public Task closeAsync(List<Module> modules) {
    Util.err.fine("close: " + modules);
    ev.log(Events.CLOSE);
    moduleList.shutDown();
    List<Task> waitFor = onStartStop.startClose(modules);
    // [PENDING] this may need to write out changed ModuleInstall externalized
    // forms...is that really necessary to do here, or isn't it enough to
    // do right after loading etc.? Currently these are only written when
    // a ModuleInstall has just been restored etc. which is probably fine.
    for (Module m : modules) {
        Class<? extends ModuleInstall> instClazz = installs.get(m);
        if (instClazz != null) {
            try {
                ModuleInstall inst = SharedClassObject.findObject(instClazz, true);
                if (inst == null) throw new IllegalStateException("Inconsistent state: " + instClazz); // NOI18N
                inst.close();
            } catch (ThreadDeath td) {
                throw td;
            } catch (Throwable t) {
                // Catch even the heavy stuff here, we are going away.
                Util.err.log(Level.SEVERE, null, t);
                // oh well
            }
        }
    }
    waitFor.add(WarmUpSupport.waitTask());
    return new ProxyTask(waitFor);
}
项目:incubator-netbeans    文件:ManifestSection.java   
/** Create a fresh instance.
 * @return the instance
 * @exception Exception if there is an error
 */
protected final Object createInstance() throws Exception {
    if (! isDefaultInstance()) {
        try {
            Object o = Beans.instantiate(getClassLoader(), className);
            clazz = o.getClass();
            if (! getSectionClass().isAssignableFrom(clazz)) {
                throw new ClassCastException("Class " + clazz.getName() + " is not a subclass of " + getSuperclass().getName()); // NOI18N
            }
            return o;
        } catch (ClassNotFoundException cnfe) {
            Exceptions.attachMessage(cnfe,
                                     "Loader for ClassNotFoundException: " +
                                     getClassLoader());
            throw cnfe;
        } catch (LinkageError le) {
            throw new ClassNotFoundException(le.toString(), le);
        }
    } else {
        getSectionClass(); // might throw some exceptions
        if (SharedClassObject.class.isAssignableFrom(clazz)) {
            return SharedClassObject.findObject(clazz.asSubclass(SharedClassObject.class), true);
        } else {
            return clazz.newInstance();
        }
    }
}
项目:incubator-netbeans    文件:SharedClassObjectFactory.java   
@Override
public <T> T createInstance(Class<T> clazz) {
    if (SharedClassObject.class.isAssignableFrom(clazz)) {
        return (T)SharedClassObject.findObject(clazz.asSubclass(SharedClassObject.class), true);
    } else {
        return null;
    }
}
项目:incubator-netbeans    文件:SharedClassObjectFactoryTest.java   
public void testSharedClassObject() throws Exception {
    Shared instance = SharedClassObject.findObject(Shared.class, true);
    FileObject data = FileUtil.createData(root, "dir/" + Shared.class.getName().replace('.', '-') + ".instance");
    Lookup l = Lookups.forPath("dir");
    assertSame(instance, l.lookup(Shared.class));

    Shared created = FileUtil.getConfigObject(data.getPath(), Shared.class);
    assertSame("Config file found", instance, created);
}
项目:incubator-netbeans    文件:RetoucheTestBase.java   
@Override
protected void setUp() throws Exception {
    final FileObject sd = SourceUtilsTestUtil.makeScratchDir(this);
    final FileObject src = sd.createFolder("src");
    ClassPathProvider cpp = new ClassPathProvider() {

        public ClassPath findClassPath(FileObject file, String type) {
            if (type.equals(ClassPath.SOURCE)) {
                return ClassPathSupport.createClassPath(new FileObject[]{src});
            }
            if (type.equals(ClassPath.COMPILE)) {
                return ClassPathSupport.createClassPath(new FileObject[0]);
            }
            if (type.equals(ClassPath.BOOT)) {
                return createClassPath(System.getProperty("sun.boot.class.path"));
            }
            return null;
        }
    };
    SharedClassObject loader = JavaDataLoader.findObject(JavaDataLoader.class, true);

    SourceUtilsTestUtil.prepareTest(src, sd.createFolder("build"), sd.createFolder("cache"));
    SourceUtilsTestUtil.prepareTest(
            new String[]{},
            new Object[]{loader, cpp});
    testFO = FileUtil.createFolder(src, "sample/pkg/").createData("Test.java");
    TestUtilities.copyStringToFile(testFO,
            "package sample.pkg;\n" +
            "\n" +
            "public class Test {\n" +
            "\n" +
            "    @Deprecated\n" +
            "    void method() {\n" +
            "    }\n" +
            "\n" +
            "}\n");
}
项目:incubator-netbeans    文件:SerialDataConvertor.java   
private static boolean isSystemOption(final Object obj) {
    boolean b =  false;
    if (obj != null && obj instanceof SharedClassObject){
        for(Class c = obj.getClass(); !b && c != null; c = c.getSuperclass()) {
            b =  "org.openide.options.SystemOption".equals(c.getName());//NOI18N
        }
    }
    return b;
}
项目:incubator-netbeans    文件:SerialDataNode.java   
/** Indicate whether the node may be destroyed.
 * @return tests {@link DataObject#isDeleteAllowed}
 */
public boolean canDestroy() {
    try {
        InstanceCookie ic = ic();
        if (ic == null) return true;
        Class clazz = ic.instanceClass();
        return (!SharedClassObject.class.isAssignableFrom(clazz));
    } catch (Exception ex) {
        return true;
    }
}
项目:incubator-netbeans    文件:SerialDataNode.java   
public boolean canCut() {
    try {
        InstanceCookie ic = ic();
        if (ic == null) return false;
        Class clazz = ic.instanceClass();
        return (!SharedClassObject.class.isAssignableFrom(clazz));
    } catch (Exception ex) {
        return false;
    }
}
项目:incubator-netbeans    文件:SerialDataNode.java   
public boolean canCopy() {
    try {
        InstanceCookie ic = ic();
        if (ic == null) return false;
        Class clazz = ic.instanceClass();
        return (!SharedClassObject.class.isAssignableFrom(clazz));
    } catch (Exception ex) {
        return false;
    }
}
项目:incubator-netbeans    文件:SystemOptionTest.java   
/** Test manipulation of a SystemOption in memory.
 */
@RandomlyFails // http://deadlock.netbeans.org/job/NB-Core-Build/9882/testReport/
public void testBasicUsage() throws Exception {
    assertNull(SharedClassObject.findObject(SimpleOption.class, false));
    SimpleOption o = (SimpleOption)SharedClassObject.findObject(SimpleOption.class, true);
    assertEquals(3, o.getX());
    assertEquals("hello", o.getY());
    o.setX(5);
    o.setY("nue");
    assertEquals(5, o.getX());
    assertEquals("nue", o.getY());
}
项目:incubator-netbeans    文件:UiUtilsTest.java   
protected void setUp() throws Exception {
    System.setProperty("org.openide.util.Lookup", SourceUtilsTestUtil.class.getName());
    this.clearWorkDir();
    SharedClassObject loader = JavaDataLoader.findObject(JavaDataLoader.class, true);
    SourceUtilsTestUtil.prepareTest(new String[0], new Object[]{
            loader,
            new DummyClassPathProvider()
    });
    File f = new File(this.getWorkDir(), "cache");    //NOI18N
    f.mkdirs();
    IndexUtil.setCacheFolder(f);
}
项目:incubator-netbeans    文件:AbstractFileSystemCompat.java   
public SystemAction[] getActions() {
    if (!afs().isEnabledRefreshFolder()) {
        return NO_SYSTEM_ACTIONS;
    } else {
        if (SYSTEM_ACTIONS == null) {
            try {
                ClassLoader l = Lookup.getDefault().lookup(ClassLoader.class);

                if (l == null) {
                    l = getClass().getClassLoader();
                }

                Class<?> c = Class.forName("org.openide.actions.FileSystemRefreshAction", true, l); // NOI18N
                SystemAction ra = SharedClassObject.findObject(c.asSubclass(SystemAction.class), true);

                // initialize the SYSTEM_ACTIONS
                SYSTEM_ACTIONS = new SystemAction[] { ra };
            } catch (Exception ex) {
                // ok, we are probably running in standalone mode and
                // classes needed to initialize the RefreshAction are
                // not available
                SYSTEM_ACTIONS = NO_SYSTEM_ACTIONS;
            }
        }

        return SYSTEM_ACTIONS;
    }
}
项目:opensim-gui    文件:ModelWindowVTKTopComponent.java   
public Action[] getActions(){
    // Note: seem to need to do it this way rather than just new ViewReplicateAction(), etc. because java complains otherwise
    // about creating multiple instances of a shared object.
    ViewReplicateAction act1 = (ViewReplicateAction) SharedClassObject.findObject(ViewReplicateAction.class, true);   // New...
    ViewEditAction act2 = (ViewEditAction) SharedClassObject.findObject(ViewEditAction.class, true); //Edit...
    Action[] superActs = super.getActions();

    return (new Action[]{superActs[8],act1,act2});
}
项目:incubator-netbeans    文件:ActionManager.java   
/**
 * Constructor.
 */
protected ActionManager(Class<A> actionCls, Class<S> origSysActionCls) {
    this.origSysActionCls = origSysActionCls;
    action = SharedClassObject.findObject(actionCls, true);
}
项目:incubator-netbeans    文件:ScriptingCreateFromTemplateTest.java   
@Override
protected void setUp() throws Exception {
    MockLookup.setInstances(SharedClassObject.findObject(SimpleLoader.class, true));
}
项目:incubator-netbeans    文件:GeneratorTestBase.java   
protected void setUp() throws Exception {
    super.setUp();
    SourceUtilsTestUtil.prepareTest(new String[0], new Object[0]);
    // ensure JavaKit is present, so that NbEditorDocument is eventually created.
    // it handles PositionRefs differently than PlainDocument/PlainEditorKit.
    MockMimeLookup.setInstances(MimePath.get("text/x-java"), 
            new Reindenter.Factory(), new JavaKit());
    dataDir = SourceUtilsTestUtil.makeScratchDir(this);
    FileObject dataTargetPackage = FileUtil.createFolder(dataDir, getSourcePckg());
    assertNotNull(dataTargetPackage);
    FileObject dataSourceFolder = FileUtil.toFileObject(getDataDir()).getFileObject(getSourcePckg());
    assertNotNull(dataSourceFolder);
    deepCopy(dataSourceFolder, dataTargetPackage);
    ClassPathProvider cpp = new ClassPathProvider() {
        public ClassPath findClassPath(FileObject file, String type) {
            if (type == ClassPath.SOURCE)
                return ClassPathSupport.createClassPath(new FileObject[] {dataDir});
                if (type == ClassPath.COMPILE)
                    return ClassPathSupport.createClassPath(new FileObject[0]);
                if (type == ClassPath.BOOT)
                    return createClassPath(System.getProperty("sun.boot.class.path"));
                return null;
        }
    };
    SharedClassObject loader = JavaDataLoader.findObject(JavaDataLoader.class, true);

    SourceUtilsTestUtil.prepareTest(
            new String[] {
                "org/netbeans/modules/java/project/ui/layer.xml", 
                "org/netbeans/modules/project/ui/resources/layer.xml"
            },
            new Object[] {loader, cpp}
    );

    JEditorPane.registerEditorKitForContentType("text/x-java", "org.netbeans.modules.editor.java.JavaKit");
    File cacheFolder = new File(getWorkDir(), "var/cache/index");
    cacheFolder.mkdirs();
    IndexUtil.setCacheFolder(cacheFolder);
    ensureRootValid(dataDir.getURL());
    TestUtil.setupEditorMockServices();
}
项目:incubator-netbeans    文件:BinaryFS.java   
public Object getValue( BFSBase foProvider, String attrName) {
    try {
        switch(index) {
            case 0: // bytevalue
                return Byte.valueOf(value);
            case 1: // shortvalue
                return Short.valueOf(value);
            case 2: // intvalue
                return Integer.valueOf(value);
            case 3: // longvalue
                return Long.valueOf(value);
            case 4: // floatvalue
                return Float.valueOf(value);
            case 5: // doublevalue
                return Double.valueOf(value);
            case 6: // boolvalue
                return Boolean.valueOf(value);
            case 7: // charvalue
                if (value.trim().length() != 1) break;
                return value.charAt(0);
            case 8: // stringvalue
                return value;
            case 9: // urlvalue
                return new URL(value);
            case 10: // methodvalue
                return methodValue(value, foProvider, attrName).invoke();
            case 11: // newvalue
                Class<?> cls =  findClass (value);
                // special support for singletons
                if (SharedClassObject.class.isAssignableFrom(cls)) {
                    return SharedClassObject.findObject(cls.asSubclass(SharedClassObject.class), true);
                } else {
                    Constructor<?> init = cls.getDeclaredConstructor();
                    init.setAccessible(true);
                    return init.newInstance((Object[]) null);
                }

            case 12: // serialvalue
                return decodeValue(value);
            case 13: // bundle value
                String[] arr = value.split("#", 2); // NOI18N
                return NbBundle.getBundle(arr[0]).getObject(arr[1]);
            default:
                throw new IllegalStateException("Bad index: " + index); // NOI18N
        }
    } catch (Exception exc) {
        LOG.log(notified.add(foProvider.getPath()) ? Level.INFO : Level.FINE, "value = " + value + " from " + foProvider.getPath(), exc); // NOI18N
    }
    return null; // problem getting the value...
}
项目:incubator-netbeans    文件:CanYouCreateFolderLookupFromHandleFindTest.java   
protected Enumeration loaders() {
    return Enumerations.singleton(SharedClassObject.findObject(MyLoader.class, true));
}
项目:incubator-netbeans    文件:SettingsRecognizer.java   
/** Create an instance.
 * @return the instance of type {@link #instanceClass}
 * @exception IOException if an I/O error occured
 * @exception ClassNotFoundException if a class was not found
 */
public Object instanceCreate() throws java.io.IOException, ClassNotFoundException {
    Object inst = null;

    // deserialize
    inst = readSerial(getSerializedInstance());

    // default instance
    if (inst == null) {
        if (instanceMethod != null) {
            inst = createFromMethod(instanceClass, instanceMethod);
        } else {
            // use default constructor
            Class<?> clazz = instanceClass();
            if (SharedClassObject.class.isAssignableFrom(clazz)) {
                inst = SharedClassObject.findObject(clazz.asSubclass(SharedClassObject.class), false);
                if (null != inst) {
                    // instance already exists -> reset it to defaults
                    try {
                        Method method = SharedClassObject.class.getDeclaredMethod("reset", new Class[0]); // NOI18N
                        method.setAccessible(true);
                        method.invoke(inst, new Object[0]);
                    } catch (Exception e) {
                        ErrorManager.getDefault().notify(e);
                    }
                } else {
                    inst = SharedClassObject.findObject(clazz.asSubclass(SharedClassObject.class), true);
                }
            } else {
                try {
                    inst = clazz.newInstance();
                } catch (Exception ex) {
                    IOException ioe = new IOException();
                    ErrorManager emgr = ErrorManager.getDefault();
                    emgr.annotate(ioe, ex);
                    emgr.annotate(ioe, "Content: \n" + getFileContent(source)); // NOI18N
                    emgr.annotate(ioe, "Class: " + clazz); // NOI18N
                    emgr.annotate(ioe, "Source: " + source); // NOI18N
                    throw ioe;
                }
            }
        }
    }

    return inst;
}
项目:incubator-netbeans    文件:ScriptingCreateFromTemplateTest.java   
@Override
protected void setUp() throws Exception {
    MockLookup.setInstances(SharedClassObject.findObject(SimpleLoader.class, true));
}
项目:incubator-netbeans    文件:XMLSettingsSupport.java   
/** Create an instance.
 * @return the instance of type {@link #instanceClass}
 * @exception IOException if an I/O error occured
 * @exception ClassNotFoundException if a class was not found
 */
public Object instanceCreate() throws java.io.IOException, ClassNotFoundException {
    Object inst = null;

    // deserialize
    inst = readSerial(getSerializedInstance());

    // default instance
    if (inst == null) {
        if (instanceMethod != null) {
            inst = createFromMethod(instanceClass, instanceMethod);
        } else {
            // use default constructor
            Class<?> clazz = instanceClass();
            if (SharedClassObject.class.isAssignableFrom(clazz)) {
                inst = SharedClassObject.findObject(clazz.asSubclass(SharedClassObject.class), false);
                if (null != inst) {
                    // instance already exists -> reset it to defaults
                    try {
                        Method method = SharedClassObject.class.getDeclaredMethod("reset", new Class[0]); // NOI18N
                        method.setAccessible(true);
                        method.invoke(inst, new Object[0]);
                    } catch (Exception e) {
                        Exceptions.printStackTrace(e);
                    }
                } else {
                    inst = SharedClassObject.findObject(clazz.asSubclass(SharedClassObject.class), true);
                }
            } else {
                try {
                    inst = newInstance(clazz);
                } catch (Exception ex) {
                    IOException ioe = new IOException();
                    ioe.initCause(ex);
                    Exceptions.attachMessage(ioe,
                                                      "Content: \n" +
                                                      getFileContent(source)); // NOI18N
                    Exceptions.attachMessage(ioe,
                                                      "Class: " + clazz); // NOI18N
                    Exceptions.attachMessage(ioe,
                                                      "Source: " +
                                                      source); // NOI18N
                    throw ioe;
                }
            }
        }
    }

    return inst;
}
项目:incubator-netbeans    文件:DashboardUtils.java   
public static String getFindActionMapKey() {
    return SharedClassObject.findObject(FindAction.class, true).getActionMapKey().toString();
}
项目:studio    文件:XMLMapAttr.java   
/**
 * Encodes Object into String encoded in HEX format
 * @param params Array (2 length) of objects ( Object[] o = {fo,name}).  Attribute is assigned to some fo-FileObject and has its name-String. 
 * params can be null.
 * @return   Object or null
 */                
private  Object getObject(Object[] params) throws Exception {
    int index;
    if (obj != null) return obj;//back compatibility

    if ((index = isValid()) != -1) {
        try {
            switch(index) {
                case 0:
                    return new Byte(value);
                case 1:
                    return new Short(value);
                case 2:
                    return new Integer(value);//(objI);
                case 3:
                    return  new Long(value);
                case 4:
                    return  new Float(value);
                case 5:
                    return new Double(value);
                case 6:
                    return Boolean.valueOf(value);
                case 7:
                    if (value.trim().length() != 1) break;
                    return new Character(value.charAt(0));
                case 8:
                    return value;
                case 9:
                    return methodValue (value,params);
                case 10:
                    return decodeValue(value);
                case 11:
                    return new URL(value);
                case 12:

                    // special support for singletons

                    Class cls =  ExternalUtil.findClass (Utilities.translate (value));
                    if (SharedClassObject.class.isAssignableFrom(cls)) {
                        return SharedClassObject.findObject(cls, true);
                    } else {   
                        return cls.newInstance();
                    }

            }
        } catch (Exception exc) {
            ExternalUtil.annotate (exc, "value = "+value); //NOI18N
            throw exc;
        } catch (LinkageError e) {
            throw (ClassNotFoundException)ExternalUtil.annotate(new ClassNotFoundException(value), e);
        }

    }
    throw new InstantiationException (value);
}