/** Find the service type implemented as a given class. * The whole registry is searched for a service type of that exact class (subclasses do not count). * <P> * This could be used during (de-)serialization * of a service type: only store its class name * and then try to find the type implemented by that class later. * * @param clazz the class of the service type looked for * @return the desired type or <code>null</code> if it does not exist * @deprecated Just use lookup. */ @Deprecated public ServiceType find(Class clazz) { Enumeration en = services(); while (en.hasMoreElements()) { Object o = en.nextElement(); if (o.getClass() == clazz) { return (ServiceType) o; } } return null; }
Enumeration en = r.services(clazz); ServiceType some = r.find(clazz);
/** Find a service type of a supplied name in the registry. * <P> * This could be used during (de-)serialization * of a service type: only store its name * and then try to find the type later. * * @param name (display) name of service type to find * @return the desired type or <code>null</code> if it does not exist */ public ServiceType find(String name) { Enumeration en = services(); while (en.hasMoreElements()) { ServiceType o = (ServiceType) en.nextElement(); if (name.equals(o.getName())) { return o; } } return null; } }
/** Find the service type implemented as a given class. * The whole registry is searched for a service type of that exact class (subclasses do not count). * <P> * This could be used during (de-)serialization * of a service type: only store its class name * and then try to find the type implemented by that class later. * * @param clazz the class of the service type looked for * @return the desired type or <code>null</code> if it does not exist * @deprecated Just use lookup. */ public ServiceType find (Class clazz) { Enumeration en = services (); while (en.hasMoreElements ()) { Object o = en.nextElement (); if (o.getClass () == clazz) { return (ServiceType)o; } } return null; }
/** Find the service type implemented as a given class. * The whole registry is searched for a service type of that exact class (subclasses do not count). * <P> * This could be used during (de-)serialization * of a service type: only store its class name * and then try to find the type implemented by that class later. * * @param clazz the class of the service type looked for * @return the desired type or <code>null</code> if it does not exist * @deprecated Just use lookup. */ public ServiceType find (Class clazz) { Enumeration en = services (); while (en.hasMoreElements ()) { Object o = en.nextElement (); if (o.getClass () == clazz) { return (ServiceType)o; } } return null; }
/** Find a service type of a supplied name in the registry. * <P> * This could be used during (de-)serialization * of a service type: only store its name * and then try to find the type later. * * @param name (display) name of service type to find * @return the desired type or <code>null</code> if it does not exist */ public ServiceType find (String name) { Enumeration en = services (); while (en.hasMoreElements ()) { ServiceType o = (ServiceType)en.nextElement (); if (name.equals (o.getName ())) { return o; } } return null; } }
/** Find a service type of a supplied name in the registry. * <P> * This could be used during (de-)serialization * of a service type: only store its name * and then try to find the type later. * * @param name (display) name of service type to find * @return the desired type or <code>null</code> if it does not exist */ public ServiceType find(String name) { Enumeration en = services(); while (en.hasMoreElements()) { ServiceType o = (ServiceType) en.nextElement(); if (name.equals(o.getName())) { return o; } } return null; } }
/** Find a service type of a supplied name in the registry. * <P> * This could be used during (de-)serialization * of a service type: only store its name * and then try to find the type later. * * @param name (display) name of service type to find * @return the desired type or <code>null</code> if it does not exist */ public ServiceType find (String name) { Enumeration en = services (); while (en.hasMoreElements ()) { ServiceType o = (ServiceType)en.nextElement (); if (name.equals (o.getName ())) { return o; } } return null; } }
/** Find the service type implemented as a given class. * The whole registry is searched for a service type of that exact class (subclasses do not count). * <P> * This could be used during (de-)serialization * of a service type: only store its class name * and then try to find the type implemented by that class later. * * @param clazz the class of the service type looked for * @return the desired type or <code>null</code> if it does not exist * @deprecated Just use lookup. */ @Deprecated public ServiceType find(Class clazz) { Enumeration en = services(); while (en.hasMoreElements()) { Object o = en.nextElement(); if (o.getClass() == clazz) { return (ServiceType) o; } } return null; }
/** Find the service type implemented as a given class. * The whole registry is searched for a service type of that exact class (subclasses do not count). * <P> * This could be used during (de-)serialization * of a service type: only store its class name * and then try to find the type implemented by that class later. * * @param clazz the class of the service type looked for * @return the desired type or <code>null</code> if it does not exist * @deprecated Just use lookup. */ @Deprecated public ServiceType find(Class clazz) { Enumeration en = services(); while (en.hasMoreElements()) { Object o = en.nextElement(); if (o.getClass() == clazz) { return (ServiceType) o; } } return null; }
/** Find a service type of a supplied name in the registry. * <P> * This could be used during (de-)serialization * of a service type: only store its name * and then try to find the type later. * * @param name (display) name of service type to find * @return the desired type or <code>null</code> if it does not exist */ public ServiceType find(String name) { Enumeration en = services(); while (en.hasMoreElements()) { ServiceType o = (ServiceType) en.nextElement(); if (name.equals(o.getName())) { return o; } } return null; } }
/** Get all available services that are assignable to the given superclass. * @param clazz the class that all services should be subclass of * @return an enumeration of all matching {@link ServiceType}s */ public Enumeration services (final Class clazz) { class IsInstance implements org.openide.util.Enumerations.Processor { public Object process (Object obj, java.util.Collection ignore) { return clazz.isInstance (obj) ? obj : null; } } return org.openide.util.Enumerations.filter (services (), new IsInstance ()); }
/** Get all available services that are assignable to the given superclass. * @param clazz the class that all services should be subclass of * @return an enumeration of all matching {@link ServiceType}s */ public Enumeration services (final Class clazz) { class IsInstance implements org.openide.util.Enumerations.Processor { public Object process (Object obj, java.util.Collection ignore) { return clazz.isInstance (obj) ? obj : null; } } return org.openide.util.Enumerations.filter (services (), new IsInstance ()); }
/** Get all available services that are assignable to the given superclass. * @param clazz the class that all services should be subclass of * @return an enumeration of all matching {@link ServiceType}s */ public <T extends ServiceType> Enumeration<T> services(final Class<T> clazz) { class IsInstance implements Enumerations.Processor<ServiceType,T> { public T process(ServiceType obj, Collection ignore) { return clazz.isInstance(obj) ? clazz.cast(obj) : null; } } return Enumerations.filter(services(), new IsInstance()); }
/** Get all available services that are assignable to the given superclass. * @param clazz the class that all services should be subclass of * @return an enumeration of all matching {@link ServiceType}s */ public <T extends ServiceType> Enumeration<T> services(final Class<T> clazz) { class IsInstance implements Enumerations.Processor<ServiceType,T> { public T process(ServiceType obj, Collection ignore) { return clazz.isInstance(obj) ? clazz.cast(obj) : null; } } return Enumerations.filter(services(), new IsInstance()); }
Enumeration en = r.services(clazz); ServiceType some = r.find(clazz);
/** Find the service type implemented as a given class. * The whole registry is searched for a service type of that exact class (subclasses do not count). * <P> * This could be used during (de-)serialization * of a service type: only store its class name * and then try to find the type implemented by that class later. * * @param clazz the class of the service type looked for * @return the desired type or <code>null</code> if it does not exist * @deprecated Just use lookup. */ @Deprecated public ServiceType find(Class clazz) { Enumeration en = services(); while (en.hasMoreElements()) { Object o = en.nextElement(); if (o.getClass() == clazz) { return (ServiceType) o; } } return null; }
/** Find a service type of a supplied name in the registry. * <P> * This could be used during (de-)serialization * of a service type: only store its name * and then try to find the type later. * * @param name (display) name of service type to find * @return the desired type or <code>null</code> if it does not exist */ public ServiceType find(String name) { Enumeration en = services(); while (en.hasMoreElements()) { ServiceType o = (ServiceType) en.nextElement(); if (name.equals(o.getName())) { return o; } } return null; } }
/** Get all available services that are assignable to the given superclass. * @param clazz the class that all services should be subclass of * @return an enumeration of all matching {@link ServiceType}s */ public <T extends ServiceType> Enumeration<T> services(final Class<T> clazz) { class IsInstance implements Enumerations.Processor<ServiceType,T> { public T process(ServiceType obj, Collection ignore) { return clazz.isInstance(obj) ? clazz.cast(obj) : null; } } return Enumerations.filter(services(), new IsInstance()); }
/** Get all available services that are assignable to the given superclass. * @param clazz the class that all services should be subclass of * @return an enumeration of all matching {@link ServiceType}s */ public <T extends ServiceType> Enumeration<T> services(final Class<T> clazz) { class IsInstance implements Enumerations.Processor<ServiceType,T> { public T process(ServiceType obj, Collection ignore) { return clazz.isInstance(obj) ? clazz.cast(obj) : null; } } return Enumerations.filter(services(), new IsInstance()); }