Example usage for java.util EnumSet of

List of usage examples for java.util EnumSet of

Introduction

In this page you can find the example usage for java.util EnumSet of.

Prototype

public static <E extends Enum<E>> EnumSet<E> of(E e1, E e2, E e3) 

Source Link

Document

Creates an enum set initially containing the specified elements.

Usage

From source file:SizeSet.java

public static void main(String[] args) {
    EnumSet largeSize = EnumSet.of(Size.XL, Size.XXL, Size.XXXL);
    for (Iterator it = largeSize.iterator(); it.hasNext();) {
        Size size = (Size) it.next();/*from  www . ja v a  2  s.co  m*/
        System.out.println(size);
    }
}

From source file:Numbers.java

public static void main(String[] args) {

    // create a set
    EnumSet<Numbers> set;//from  w  ww .jav  a 2s . c om

    // add elements
    set = EnumSet.of(Numbers.FIVE, Numbers.FOUR, Numbers.THREE);

    System.out.println(set);

}

From source file:Main.java

public static void updatePermissions(PosixFileAttributeView posixView) throws Exception {
    Set<PosixFilePermission> permissions = EnumSet.of(PosixFilePermission.OWNER_READ,
            PosixFilePermission.OWNER_WRITE, PosixFilePermission.GROUP_READ);
    posixView.setPermissions(permissions);
    System.out.println("Permissions set successfully.");
}

From source file:http2.DispatcherServletInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    servletContext.addFilter("pcf", "org.eclipse.jetty.servlets.PushCacheFilter").addMappingForUrlPatterns(
            EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE), true, "/*");
    super.onStartup(servletContext);
}

From source file:io.github.microcks.config.WebConfiguration.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    log.info("Starting web application configuration, using profiles: {}",
            Arrays.toString(env.getActiveProfiles()));
    EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD,
            DispatcherType.ASYNC);//w  w w .  ja v  a 2  s  .  co m
    initCORSFilter(servletContext, disps);
    if (env.acceptsProfiles(ConfigurationConstants.PROFILE_PRODUCTION)) {
        //initStaticResourcesFilter(servletContext, disps);
    }
    log.info("Web application fully configured");
}

From source file:com.jiwhiz.web.config.WebConfigurer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    log.info("Web application configuration, using profiles: {}", Arrays.toString(env.getActiveProfiles()));
    EnumSet<DispatcherType> disps = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD,
            DispatcherType.ASYNC);//from  ww w.  j av a2 s . c o m
    if (env.acceptsProfiles("prod")) {
        initCachingHttpHeadersFilter(servletContext, disps);
        initStaticResourcesProductionFilter(servletContext, disps);
    }
    log.info("Web application fully configured");
}

From source file:com.healthcit.cacure.model.QuestionnaireForm.java

@Override
protected EnumSet<FormStatus> getAllowedStatuses() {
    return EnumSet.of(FormStatus.IN_PROGRESS, FormStatus.IN_REVIEW, FormStatus.APPROVED);
}

From source file:fr.treeptik.cloudunit.initializer.ApplicationConfig.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
    rootContext.register(CloudUnitApplicationContext.class);

    ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME,
            new DispatcherServlet(rootContext));
    dispatcher.setLoadOnStartup(1);/*from  ww w  .  j  a v a  2s  . c o m*/
    dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING);
    dispatcher.setAsyncSupported(true);

    FilterRegistration.Dynamic security = servletContext.addFilter("springSecurityFilterChain",
            new DelegatingFilterProxy());
    EnumSet<DispatcherType> securityDispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD,
            DispatcherType.ASYNC);

    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/user/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/file/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/logs/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/messages/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/application/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/server/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/snapshot/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/module/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/admin/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/image/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/nopublic/*");

    security.setAsyncSupported(true);

    servletContext.addListener(new ContextLoaderListener(rootContext));
}

From source file:cn.org.once.cstack.initializer.ApplicationConfig.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {

    AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
    rootContext.register(CloudUnitApplicationContext.class);

    ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME,
            new DispatcherServlet(rootContext));
    dispatcher.setLoadOnStartup(1);//from  ww  w  .  j  av a2  s. co  m
    dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING);
    dispatcher.setAsyncSupported(true);

    FilterRegistration.Dynamic security = servletContext.addFilter("springSecurityFilterChain",
            new DelegatingFilterProxy());
    EnumSet<DispatcherType> securityDispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD,
            DispatcherType.ASYNC);

    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/user/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/file/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/logs/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/messages/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/application/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/server/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/snapshot/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/module/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/admin/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/image/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/scripting/*");
    security.addMappingForUrlPatterns(securityDispatcherTypes, false, "/gitlab/*");

    security.setAsyncSupported(true);

    servletContext.addListener(new ContextLoaderListener(rootContext));

}

From source file:io.jmnarloch.spring.request.correlation.support.RequestCorrelationConfiguration.java

@Bean
public FilterRegistrationBean requestCorrelationFilterBean(RequestCorrelationFilter correlationFilter) {

    final FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
    filterRegistration.setFilter(correlationFilter);
    filterRegistration.setMatchAfter(false);
    filterRegistration.setDispatcherTypes(
            EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC));
    filterRegistration.setAsyncSupported(true);
    filterRegistration.setOrder(Ordered.HIGHEST_PRECEDENCE);
    return filterRegistration;
}