List of usage examples for org.springframework.util StringUtils toStringArray
public static String[] toStringArray(@Nullable Enumeration<String> enumeration)
From source file:com.griddynamics.banshun.web.ContextParentAnnotationHandlerMapping.java
/** * @see org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping.determineUrlsForHandler(String) *///from w w w . j a v a 2 s .c om protected String[] determineUrlsForHandlerByName(String beanName) { List<String> urls = new ArrayList<String>(); if (beanName.startsWith("/")) { urls.add(beanName); } /* does nothing due to lack of * String[] aliases = getApplicationContext().getAliases(beanName); for (int i = 0; i < aliases.length; i++) { if (aliases[i].startsWith("/")) { urls.add(aliases[i]); } }*/ return StringUtils.toStringArray(urls); }
From source file:fr.mby.utils.common.prefs.StreamPreferences.java
@Override protected String[] keysSpi() throws BackingStoreException { return StringUtils.toStringArray(this.prefsStorage.keySet()); }
From source file:org.easyj.rest.view.JSONView.java
private JsonConfig setJSONConfig() { Map<Class, List<String>> exclusions = getPropExclusions(); JsonConfig config = new JsonConfig(); if (exclusions != null && !exclusions.isEmpty()) { for (Class klass : exclusions.keySet()) { config.registerPropertyExclusions(klass, StringUtils.toStringArray(exclusions.get(klass))); }// www .j a v a 2s .co m config.registerJsonValueProcessor(Date.class, new DateFormatJsonValueProcessor(dateFormat)); } return config; }
From source file:fr.mby.utils.common.prefs.StreamPreferences.java
@Override protected String[] childrenNamesSpi() throws BackingStoreException { return StringUtils.toStringArray(this.childrenStorage.keySet()); }
From source file:nl.jeslee.jersey.server.spring.scope.JaxrsRequestAttributes.java
@Override public String[] getAttributeNames(int scope) { if (!isRequestActive()) { throw new IllegalStateException("NOT_IN_REQUEST_SCOPE"); }//from w w w . j a va2 s. com return StringUtils.toStringArray(requestContext.getPropertyNames()); }
From source file:org.glassfish.jersey.server.spring.scope.JaxrsRequestAttributes.java
@Override public String[] getAttributeNames(int scope) { if (!isRequestActive()) { throw new IllegalStateException(LocalizationMessages.NOT_IN_REQUEST_SCOPE()); }/*from w w w. j a va2 s . c om*/ return StringUtils.toStringArray(requestContext.getPropertyNames()); }
From source file:ch.rasc.wampspring.config.WampSession.java
/** * Retrieve the names of all attributes. * @return the attribute names as String array, never {@code null} */// w w w .jav a2 s . c o m public String[] getAttributeNames() { return StringUtils.toStringArray(this.webSocketSession.getAttributes().keySet()); }
From source file:com.graby.store.base.remote.RemotingAnnotationHandlerMapping.java
/** * Checks for presence of the {@link org.springframework.web.bind.annotation.RequestMapping} * annotation on the handler class and on any of its methods. *//* w ww . j a v a2 s . c o m*/ protected String[] determineUrlsForHandler(String beanName) { ApplicationContext context = getApplicationContext(); Class<?> handlerType = context.getType(beanName); RemotingService mapping = AnnotationUtils.findAnnotation(handlerType, RemotingService.class); if (mapping == null && context instanceof ConfigurableApplicationContext && context.containsBeanDefinition(beanName)) { ConfigurableApplicationContext cac = (ConfigurableApplicationContext) context; BeanDefinition bd = cac.getBeanFactory().getMergedBeanDefinition(beanName); if (bd instanceof AbstractBeanDefinition) { AbstractBeanDefinition abd = (AbstractBeanDefinition) bd; if (abd.hasBeanClass()) { Class<?> beanClass = abd.getBeanClass(); mapping = AnnotationUtils.findAnnotation(beanClass, RemotingService.class); } } } if (mapping != null) { this.cachedMappings.put(handlerType, mapping); Set<String> urls = new LinkedHashSet<String>(); String path = mapping.serviceUrl(); if (path != null) { addUrlsForPath(urls, path); return StringUtils.toStringArray(urls); } else { return null; } } else { return null; } }
From source file:architecture.user.security.spring.userdetails.ExtendedUserDetailsService.java
protected List<GrantedAuthority> getFinalUserAuthority(User user) { ApplicationProperties setupProperties = AdminHelper.getRepository().getSetupApplicationProperties(); String authority = setupProperties .get(architecture.ee.util.ApplicationConstants.SECURITY_AUTHENTICATION_AUTHORITY_PROP_NAME); long userId = user.getUserId(); List<Role> userRoles = roleManager.getFinalUserRoles(userId); List<String> roles = new ArrayList<String>(); for (Role role : userRoles) { roles.add(role.getName());/*ww w.j av a2s . c o m*/ } log.debug(" authority:" + authority); if (!architecture.common.util.StringUtils.isEmpty(authority)) { authority = authority.trim(); if (!roles.contains(authority)) { roles.add(authority); } } return AuthorityUtils.createAuthorityList(StringUtils.toStringArray(roles)); }
From source file:com.griddynamics.banshun.web.ContextParentAnnotationHandlerMapping.java
protected String[] determineUrlsByAnnotations(Object handler) { Class<? extends Object> handlerType = handler.getClass(); RequestMapping mapping = AnnotationUtils.findAnnotation(handlerType, RequestMapping.class); if (mapping != null) { // @RequestMapping found at type level this.cachedMappings.put(handlerType, mapping); Set<String> urls = new LinkedHashSet<String>(); String[] paths = mapping.value(); if (paths.length > 0) { // @RequestMapping specifies paths at type level for (String path : paths) { addUrlsForPath(urls, path); }/* w w w . j a v a 2 s .c om*/ return StringUtils.toStringArray(urls); } else { // actual paths specified by @RequestMapping at method level return determineUrlsForHandlerMethods(handlerType); } } else if (AnnotationUtils.findAnnotation(handlerType, Controller.class) != null) { // @RequestMapping to be introspected at method level return determineUrlsForHandlerMethods(handlerType); } else { return null; } }