Java Code Examples for org.springframework.core.annotation.AnnotationAttributes#getNumber()
The following examples show how to use
org.springframework.core.annotation.AnnotationAttributes#getNumber() .
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: DurableClientConfiguration.java From spring-boot-data-geode with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("all") public void setImportMetadata(AnnotationMetadata importMetadata) { if (isAnnotationPresent(importMetadata)) { AnnotationAttributes enableDurableClientAttributes = getAnnotationAttributes(importMetadata); this.durableClientId = enableDurableClientAttributes.containsKey("id") ? enableDurableClientAttributes.getString("id") : null; this.durableClientTimeout = enableDurableClientAttributes.containsKey("timeout") ? enableDurableClientAttributes.getNumber("timeout") : DEFAULT_DURABLE_CLIENT_TIMEOUT; this.keepAlive = enableDurableClientAttributes.containsKey("keepAlive") ? enableDurableClientAttributes.getBoolean("keepAlive") : DEFAULT_KEEP_ALIVE; this.readyForEvents = enableDurableClientAttributes.containsKey("readyForEvents") ? enableDurableClientAttributes.getBoolean("readyForEvents") : DEFAULT_READY_FOR_EVENTS; } }
Example 2
Source File: DefaultApolloConfigRegistrarHelper.java From apollo with Apache License 2.0 | 6 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { AnnotationAttributes attributes = AnnotationAttributes .fromMap(importingClassMetadata.getAnnotationAttributes(EnableApolloConfig.class.getName())); String[] namespaces = attributes.getStringArray("value"); int order = attributes.getNumber("order"); PropertySourcesProcessor.addNamespaces(Lists.newArrayList(namespaces), order); Map<String, Object> propertySourcesPlaceholderPropertyValues = new HashMap<>(); // to make sure the default PropertySourcesPlaceholderConfigurer's priority is higher than PropertyPlaceholderConfigurer propertySourcesPlaceholderPropertyValues.put("order", 0); BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, PropertySourcesPlaceholderConfigurer.class.getName(), PropertySourcesPlaceholderConfigurer.class, propertySourcesPlaceholderPropertyValues); BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, PropertySourcesProcessor.class.getName(), PropertySourcesProcessor.class); BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, ApolloAnnotationProcessor.class.getName(), ApolloAnnotationProcessor.class); BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, SpringValueProcessor.class.getName(), SpringValueProcessor.class); BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, SpringValueDefinitionProcessor.class.getName(), SpringValueDefinitionProcessor.class); BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, ApolloJsonValueProcessor.class.getName(), ApolloJsonValueProcessor.class); }
Example 3
Source File: HazelcastHttpSessionConfiguration.java From spring-session with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("deprecation") public void setImportMetadata(AnnotationMetadata importMetadata) { Map<String, Object> attributeMap = importMetadata .getAnnotationAttributes(EnableHazelcastHttpSession.class.getName()); AnnotationAttributes attributes = AnnotationAttributes.fromMap(attributeMap); this.maxInactiveIntervalInSeconds = attributes.getNumber("maxInactiveIntervalInSeconds"); String sessionMapNameValue = attributes.getString("sessionMapName"); if (StringUtils.hasText(sessionMapNameValue)) { this.sessionMapName = sessionMapNameValue; } FlushMode flushMode = attributes.getEnum("flushMode"); HazelcastFlushMode hazelcastFlushMode = attributes.getEnum("hazelcastFlushMode"); if (flushMode == FlushMode.ON_SAVE && hazelcastFlushMode != HazelcastFlushMode.ON_SAVE) { flushMode = hazelcastFlushMode.getFlushMode(); } this.flushMode = flushMode; this.saveMode = attributes.getEnum("saveMode"); }
Example 4
Source File: JdbcHttpSessionConfiguration.java From spring-session with Apache License 2.0 | 6 votes |
@Override public void setImportMetadata(AnnotationMetadata importMetadata) { Map<String, Object> attributeMap = importMetadata .getAnnotationAttributes(EnableJdbcHttpSession.class.getName()); AnnotationAttributes attributes = AnnotationAttributes.fromMap(attributeMap); this.maxInactiveIntervalInSeconds = attributes.getNumber("maxInactiveIntervalInSeconds"); String tableNameValue = attributes.getString("tableName"); if (StringUtils.hasText(tableNameValue)) { this.tableName = this.embeddedValueResolver.resolveStringValue(tableNameValue); } String cleanupCron = attributes.getString("cleanupCron"); if (StringUtils.hasText(cleanupCron)) { this.cleanupCron = cleanupCron; } this.flushMode = attributes.getEnum("flushMode"); this.saveMode = attributes.getEnum("saveMode"); }
Example 5
Source File: RedisHttpSessionConfiguration.java From spring-session with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("deprecation") public void setImportMetadata(AnnotationMetadata importMetadata) { Map<String, Object> attributeMap = importMetadata .getAnnotationAttributes(EnableRedisHttpSession.class.getName()); AnnotationAttributes attributes = AnnotationAttributes.fromMap(attributeMap); this.maxInactiveIntervalInSeconds = attributes.getNumber("maxInactiveIntervalInSeconds"); String redisNamespaceValue = attributes.getString("redisNamespace"); if (StringUtils.hasText(redisNamespaceValue)) { this.redisNamespace = this.embeddedValueResolver.resolveStringValue(redisNamespaceValue); } FlushMode flushMode = attributes.getEnum("flushMode"); RedisFlushMode redisFlushMode = attributes.getEnum("redisFlushMode"); if (flushMode == FlushMode.ON_SAVE && redisFlushMode != RedisFlushMode.ON_SAVE) { flushMode = redisFlushMode.getFlushMode(); } this.flushMode = flushMode; this.saveMode = attributes.getEnum("saveMode"); String cleanupCron = attributes.getString("cleanupCron"); if (StringUtils.hasText(cleanupCron)) { this.cleanupCron = cleanupCron; } }
Example 6
Source File: CacheConfiguration.java From redisson-spring-boot-starter with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void setImportMetadata(AnnotationMetadata importMetadata) { Map<String, Object> enableAttrMap = importMetadata .getAnnotationAttributes(EnableCache.class.getName()); AnnotationAttributes enableAttrs = AnnotationAttributes.fromMap(enableAttrMap); this.value=enableAttrs.getStringArray("value"); this.maxIdleTime=enableAttrs.getNumber("maxIdleTime"); this.ttl=enableAttrs.getNumber("ttl"); }
Example 7
Source File: ChoerodonRedisHttpSessionConfiguration.java From oauth-server with Apache License 2.0 | 5 votes |
public void setImportMetadata(AnnotationMetadata importMetadata) { Map<String, Object> enableAttrMap = importMetadata.getAnnotationAttributes(EnableRedisHttpSession.class.getName()); AnnotationAttributes enableAttrs = AnnotationAttributes.fromMap(enableAttrMap); this.maxInactiveIntervalInSeconds = enableAttrs.getNumber("maxInactiveIntervalInSeconds"); String redisNamespaceValue = enableAttrs.getString("redisNamespace"); if (StringUtils.hasText(redisNamespaceValue)) { this.redisNamespace = this.embeddedValueResolver.resolveStringValue(redisNamespaceValue); } this.redisFlushMode = enableAttrs.getEnum("redisFlushMode"); }
Example 8
Source File: PeakLimiterAnnotationParser.java From Limiter with Apache License 2.0 | 5 votes |
@Override public LimitedResource<PeakLimiter> parseLimiterAnnotation(AnnotationAttributes attributes) { return new PeakLimiterResource( getKey(attributes), getArgumentInjectors(attributes), getFallback(attributes), getErrorHandler(attributes), getLimiter(attributes), (int) attributes.getNumber("max") ); }
Example 9
Source File: RateLimiterAnnotationParser.java From Limiter with Apache License 2.0 | 5 votes |
@Override public LimitedResource<RateLimiter> parseLimiterAnnotation(AnnotationAttributes attributes) { return new RateLimiterResource(getKey(attributes), getArgumentInjectors(attributes), getFallback(attributes), getErrorHandler(attributes), getLimiter(attributes), (double) attributes.getNumber("rate"), (long) attributes.getNumber("capacity") ); }
Example 10
Source File: RedissonWebSessionConfiguration.java From redisson with Apache License 2.0 | 5 votes |
@Override public void setImportMetadata(AnnotationMetadata importMetadata) { Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableRedissonWebSession.class.getName()); AnnotationAttributes attrs = AnnotationAttributes.fromMap(map); keyPrefix = attrs.getString("keyPrefix"); maxInactiveIntervalInSeconds = attrs.getNumber("maxInactiveIntervalInSeconds"); }
Example 11
Source File: RedissonHttpSessionConfiguration.java From redisson with Apache License 2.0 | 5 votes |
@Override public void setImportMetadata(AnnotationMetadata importMetadata) { Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableRedissonHttpSession.class.getName()); AnnotationAttributes attrs = AnnotationAttributes.fromMap(map); keyPrefix = attrs.getString("keyPrefix"); maxInactiveIntervalInSeconds = attrs.getNumber("maxInactiveIntervalInSeconds"); }
Example 12
Source File: RedisWebSessionConfiguration.java From spring-session with Apache License 2.0 | 5 votes |
@Override public void setImportMetadata(AnnotationMetadata importMetadata) { Map<String, Object> attributeMap = importMetadata .getAnnotationAttributes(EnableRedisWebSession.class.getName()); AnnotationAttributes attributes = AnnotationAttributes.fromMap(attributeMap); this.maxInactiveIntervalInSeconds = attributes.getNumber("maxInactiveIntervalInSeconds"); String redisNamespaceValue = attributes.getString("redisNamespace"); if (StringUtils.hasText(redisNamespaceValue)) { this.redisNamespace = this.embeddedValueResolver.resolveStringValue(redisNamespaceValue); } this.saveMode = attributes.getEnum("saveMode"); }
Example 13
Source File: HttpdocFilterRegistrar.java From halo-docs with Apache License 2.0 | 4 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { AnnotationAttributes attributes = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(EnableDoc.class.getName())); BeanDefinition httpdoc = new RootBeanDefinition(FilterRegistrationBean.class); String name = attributes.getString("name"); httpdoc.getPropertyValues().add("name", name); boolean asyncSupported = attributes.getBoolean("asyncSupported"); httpdoc.getPropertyValues().add("asyncSupported", asyncSupported); DispatcherType[] dispatcherTypes = (DispatcherType[]) attributes.get("dispatcherTypes"); httpdoc.getPropertyValues().add("dispatcherTypes", EnumSet.of(dispatcherTypes[0], dispatcherTypes)); boolean matchAfter = attributes.getBoolean("matchAfter"); httpdoc.getPropertyValues().add("matchAfter", matchAfter); boolean enabled = attributes.getBoolean("enabled"); httpdoc.getPropertyValues().add("enabled", enabled); int order = attributes.getNumber("order"); httpdoc.getPropertyValues().add("order", order); String[] patterns = attributes.getStringArray("value"); httpdoc.getPropertyValues().add("urlPatterns", Arrays.asList(patterns)); Class<?> filter = attributes.getClass("filter"); httpdoc.getPropertyValues().add("filter", newInstance(filter)); Map<String, String> parameters = new LinkedHashMap<>(); AnnotationAttributes[] params = attributes.getAnnotationArray("params"); for (AnnotationAttributes param : params) parameters.put(param.getString("name"), param.getString("value")); parameters.put("packages", concat(attributes.getStringArray("packages"))); parameters.put("httpdoc", attributes.getString("httpdoc")); parameters.put("protocol", attributes.getString("protocol")); parameters.put("hostname", attributes.getString("hostname")); parameters.put("port", attributes.getNumber("port").toString()); parameters.put("context", attributes.getString("context")); parameters.put("version", attributes.getString("version")); parameters.put("dateFormat", attributes.getString("dateFormat")); parameters.put("description", attributes.getString("description")); parameters.put("charset", attributes.getString("charset")); parameters.put("contentType", attributes.getString("contentType")); parameters.put("translator", attributes.getClass("translator").getName()); parameters.put("supplier", attributes.getClass("supplier").getName()); parameters.put("interpreter", attributes.getClass("interpreter").getName()); parameters.put("converter", attributes.getClass("converter").getName()); parameters.put("serializer", attributes.getClass("serializer").getName()); parameters.put("conversionProvider", attributes.getClass("conversionProvider").getName()); httpdoc.getPropertyValues().add("initParameters", parameters); String beanName = attributes.getString("bean"); registry.registerBeanDefinition(beanName, httpdoc); }
Example 14
Source File: HttpdocFilterRegistrar.java From httpdoc with Apache License 2.0 | 4 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { AnnotationAttributes attributes = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(EnableHttpdoc.class.getName())); BeanDefinition httpdoc = new RootBeanDefinition(FilterRegistrationBean.class); String name = attributes.getString("name"); httpdoc.getPropertyValues().add("name", name); boolean asyncSupported = attributes.getBoolean("asyncSupported"); httpdoc.getPropertyValues().add("asyncSupported", asyncSupported); DispatcherType[] dispatcherTypes = (DispatcherType[]) attributes.get("dispatcherTypes"); httpdoc.getPropertyValues().add("dispatcherTypes", EnumSet.of(dispatcherTypes[0], dispatcherTypes)); boolean matchAfter = attributes.getBoolean("matchAfter"); httpdoc.getPropertyValues().add("matchAfter", matchAfter); boolean enabled = attributes.getBoolean("enabled"); httpdoc.getPropertyValues().add("enabled", enabled); int order = attributes.getNumber("order"); httpdoc.getPropertyValues().add("order", order); String[] patterns = attributes.getStringArray("value"); httpdoc.getPropertyValues().add("urlPatterns", Arrays.asList(patterns)); Class<?> filter = attributes.getClass("filter"); httpdoc.getPropertyValues().add("filter", newInstance(filter)); Map<String, String> parameters = new LinkedHashMap<>(); AnnotationAttributes[] params = attributes.getAnnotationArray("params"); for (AnnotationAttributes param : params) parameters.put(param.getString("name"), param.getString("value")); parameters.put("packages", concat(attributes.getStringArray("packages"))); parameters.put("httpdoc", attributes.getString("httpdoc")); parameters.put("protocol", attributes.getString("protocol")); parameters.put("hostname", attributes.getString("hostname")); parameters.put("port", attributes.getNumber("port").toString()); parameters.put("context", attributes.getString("context")); parameters.put("version", attributes.getString("version")); parameters.put("dateFormat", attributes.getString("dateFormat")); parameters.put("description", attributes.getString("description")); parameters.put("charset", attributes.getString("charset")); parameters.put("contentType", attributes.getString("contentType")); parameters.put("translator", attributes.getClass("translator").getName()); parameters.put("supplier", attributes.getClass("supplier").getName()); parameters.put("interpreter", attributes.getClass("interpreter").getName()); parameters.put("converter", attributes.getClass("converter").getName()); parameters.put("serializer", attributes.getClass("serializer").getName()); parameters.put("conversionProvider", attributes.getClass("conversionProvider").getName()); httpdoc.getPropertyValues().add("initParameters", parameters); String beanName = attributes.getString("bean"); registry.registerBeanDefinition(beanName, httpdoc); }