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

The following examples show how to use java.util.Collections#emptyEnumeration() . 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 File: VertxHttpRequest.java    From quarkus with 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 2
Source File: JarFile.java    From Bytecoder with 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 3
Source File: ExtensionPreventionClassLoaderWrapper.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Override
public Enumeration<URL> getResources(String name) throws IOException {

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

    return super.getResources(name);
}
 
Example 4
Source File: SourceFS.java    From netbeans with 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 5
Source File: NbRemoteLoader.java    From netbeans with 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 6
Source File: PluginsClassLoader.java    From java-specialagent with Apache License 2.0 5 votes vote down vote up
/**
 * 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 File: BuiltinClassLoader.java    From Bytecoder with 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 8
Source File: HttpRequestContext.java    From data-prep with 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 9
Source File: MockBundle.java    From vespa with 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 10
Source File: SimpleAttributeSet.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public Enumeration<?> getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 11
Source File: AbstractNettyRegistration.java    From Jinx with Apache License 2.0 4 votes vote down vote up
@Override
public Enumeration<String> getInitParameterNames() {
    return Collections.emptyEnumeration();
}
 
Example 12
Source File: SimpleAttributeSet.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 13
Source File: SimpleAttributeSet.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 14
Source File: SimpleAttributeSet.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 15
Source File: SDCClassLoader.java    From datacollector with 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 16
Source File: AbstractNettyRegistration.java    From spring-boot-starter-netty with Apache License 2.0 4 votes vote down vote up
@Override
public Enumeration<String> getInitParameterNames() {
    return Collections.emptyEnumeration();
}
 
Example 17
Source File: SimpleAttributeSet.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 18
Source File: SimpleAttributeSet.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 19
Source File: MockSamlIdpServer.java    From deprecated-security-advanced-modules with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
@Override
public Enumeration getAttributeNames() {
    return Collections.emptyEnumeration();
}
 
Example 20
Source File: ClassLoader.java    From Bytecoder with 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();
}