Java Code Examples for java.util.Collections#emptyEnumeration()

The following examples show how to use java.util.Collections#emptyEnumeration() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Bytecoder   File: JarFile.java    License: Apache License 2.0 6 votes vote down vote up
Enumeration<String> entryNames(CodeSource[] cs) {
    ensureInitialization();
    if (jv != null) {
        return jv.entryNames(this, cs);
    }

    /*
     * JAR file has no signed content. Is there a non-signing
     * code source?
     */
    boolean includeUnsigned = false;
    for (CodeSource c : cs) {
        if (c.getCodeSigners() == null) {
            includeUnsigned = true;
            break;
        }
    }
    if (includeUnsigned) {
        return unsignedEntryNames();
    } else {
        return Collections.emptyEnumeration();
    }
}
 
Example 2
Source Project: quarkus   File: VertxHttpRequest.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Enumeration<String> getAttributeNames() {
    final Map<String, Object> attributes = routingContext.data();
    if (attributes == null) {
        return Collections.emptyEnumeration();
    } else {
        Enumeration<String> en = new Enumeration<String>() {
            private Iterator<String> it = attributes.keySet().iterator();

            @Override
            public boolean hasMoreElements() {
                return it.hasNext();
            }

            @Override
            public String nextElement() {
                return it.next();
            }
        };
        return en;
    }
}
 
Example 3
Source Project: netbeans   File: SourceFS.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Enumeration<String> attributes(String name) {
    Item item = getItem(name);
    if (item != null) {
        return item.getAttributes();
    } else {
        return Collections.emptyEnumeration();
    }
}
 
Example 4
Source Project: Bytecoder   File: BuiltinClassLoader.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns the URLs of all resources of the given name on the class path.
 */
private Enumeration<URL> findResourcesOnClassPath(String name) {
    if (hasClassPath()) {
        if (System.getSecurityManager() == null) {
            return ucp.findResources(name, false);
        } else {
            PrivilegedAction<Enumeration<URL>> pa;
            pa = () -> ucp.findResources(name, false);
            return AccessController.doPrivileged(pa);
        }
    } else {
        // no class path
        return Collections.emptyEnumeration();
    }
}
 
Example 5
Source Project: data-prep   File: HttpRequestContext.java    License: Apache License 2.0 5 votes vote down vote up
public static Enumeration<String> parameters() {
    final RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
    if (attributes != null && attributes instanceof ServletRequestAttributes) {
        return ((ServletRequestAttributes) attributes).getRequest().getParameterNames();
    }
    return Collections.emptyEnumeration();
}
 
Example 6
/**
 * Creates a new {@code PluginsClassLoader} with the specified set of files
 * providing the JAR paths.
 *
 * @param files The {@code File} objects providing the JAR paths.
 */
public PluginsClassLoader(final Set<File> files) {
  // Override parent ClassLoader methods to avoid delegation of resource
  // resolution to bootstrap class loader
  super(AssembleUtil.toURLs(files), new ClassLoader(null) {
    // Overridden to ensure resources are not discovered in bootstrap class loader
    @Override
    public Enumeration<URL> getResources(final String name) throws IOException {
      return Collections.<URL>emptyEnumeration();
    }
  });
  this.set = files;
  this.array = files.toArray(new File[files.size()]);
}
 
Example 7
Source Project: netbeans   File: NbRemoteLoader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Enumeration<URL> findResources(String name) throws IOException {
    Enumeration<URL> origResources = getParent().getResources(name);
    Enumeration<URL> deleResources = oldDelegate != null ? oldDelegate.findResources(name) : Collections.<URL>emptyEnumeration();
    
    return new CompoundEnumeration<URL>(new Enumeration[] {
            origResources,
            deleResources,
            super.findResources(name)
    });
}
 
Example 8
@Override
public Enumeration<URL> getResources(String name) throws IOException {

    if (name.equals(EXTENSION)) {
        return Collections.emptyEnumeration();
    }

    return super.getResources(name);
}
 
Example 9
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 10
@SuppressWarnings("rawtypes")
@Override
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 11
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 12
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 13
@Override
public Enumeration<String> getInitParameterNames() {
    return Collections.emptyEnumeration();
}
 
Example 14
Source Project: datacollector   File: SDCClassLoader.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Enumeration<URL> getResources(String name) throws IOException {
  if (debug) {
    System.err.println("getResources(" + name + ")");
  }
  Enumeration<URL> result = null;
  if (!systemPackage.isSystem(name)) {
    // Search local repositories
    if (debug) {
      System.err.println("  Searching local repositories");
    }
    result = findResources(name);
    if (result != null && result.hasMoreElements()) {
      if (debug) {
        System.err.println("  --> Returning result from local");
      }
      return result;
    }
    if (applicationPackage.isApplication(name)) {
      if (debug) {
        System.err.println("  --> application class, returning empty enumeration");
      }
      return Collections.emptyEnumeration();
    }
  }
  // Delegate to parent unconditionally
  if (debug) {
    System.err.println("  Delegating to parent classloader unconditionally " + parent);
  }
  result = parent.getResources(name);
  if (result != null && result.hasMoreElements()) {
    if (debug) {
      List<URL> resultList = Collections.list(result);
      result = Collections.enumeration(resultList);
      System.err.println("  --> Returning result from parent: " + resultList);
    }
    return result;
  }
  // (4) Resource was not found
  if (debug) {
    System.err.println("  --> Resource not found, returning empty enumeration");
  }
  return Collections.emptyEnumeration();
}
 
Example 15
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 16
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 17
Source Project: vespa   File: MockBundle.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Enumeration<URL> findEntries(String path, String filePattern, boolean recurse) {
    return Collections.emptyEnumeration();
}
 
Example 18
Source Project: Jinx   File: AbstractNettyRegistration.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Enumeration<String> getInitParameterNames() {
    return Collections.emptyEnumeration();
}
 
Example 19
public Enumeration<?> getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 20
Source Project: Bytecoder   File: ClassLoader.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Returns an enumeration of {@link java.net.URL URL} objects
 * representing all the resources with the given name. Class loader
 * implementations should override this method.
 *
 * <p> For resources in named modules then the method must implement the
 * rules for encapsulation specified in the {@code Module} {@link
 * Module#getResourceAsStream getResourceAsStream} method. Additionally,
 * it must not find non-"{@code .class}" resources in packages of named
 * modules unless the package is {@link Module#isOpen(String) opened}
 * unconditionally. </p>
 *
 * @implSpec The default implementation returns an enumeration that
 * contains no elements.
 *
 * @param  name
 *         The resource name
 *
 * @return  An enumeration of {@link java.net.URL URL} objects for
 *          the resource. If no resources could  be found, the enumeration
 *          will be empty. Resources for which a {@code URL} cannot be
 *          constructed, are in a package that is not opened unconditionally,
 *          or access to the resource is denied by the security manager,
 *          are not returned in the enumeration.
 *
 * @throws  IOException
 *          If I/O errors occur
 *
 * @since  1.2
 * @revised 9
 * @spec JPMS
 */
protected Enumeration<URL> findResources(String name) throws IOException {
    return Collections.emptyEnumeration();
}