public static <T> T getValue(final Map<String, ?> properties, final String key, T defaultValue, final Class<T> type) { return PropertiesHelper.getValue(properties, key, defaultValue, type, null); }
/** * Returns value of a specified property. If the property is not set or the real value type is not compatible with * the specified value type, returns null. * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param type Type to retrieve the value as. * @param <T> Type of the property value. * @param legacyMap Legacy fallback map, where key is the actual property name, value is the old property name * @return Value of the property or null. */ public static <T> T getValue(Map<String, ?> properties, String key, Class<T> type, Map<String, String> legacyMap) { return getValue(properties, null, key, type, legacyMap); }
public static <T> T getValue(final Map<String, ?> properties, final String key, final Class<T> type) { return PropertiesHelper.getValue(properties, key, type, null); }
/** * Returns value of a specified property. If the property is not set or the real value type is not compatible with * the specified value type, returns null. * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param type Type to retrieve the value as. * @param <T> Type of the property value. * @param legacyMap Legacy fallback map, where key is the actual property name, value is the old property name * @return Value of the property or null. */ public static <T> T getValue(Map<String, ?> properties, String key, Class<T> type, Map<String, String> legacyMap) { return getValue(properties, null, key, type, legacyMap); }
/** * Return value of a specified property. If the property is not set or the real value type is not compatible with * defaultValue type, the specified defaultValue is returned. Calling this method is equivalent to calling * {@code PropertyHelper.getValue(properties, key, defaultValue, (Class<T>) defaultValue.getClass())} * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param defaultValue Default value to be returned if the specified property is not set or cannot be read. * @param <T> Type of the property value. * @param legacyMap Legacy fallback map, where key is the actual property name, value is the old property name * @return Value of the property or defaultValue. */ public static <T> T getValue(Map<String, ?> properties, String key, T defaultValue, Map<String, String> legacyMap) { return getValue(properties, null, key, defaultValue, legacyMap); }
/** * Return value of a specified property. If the property is not set or the real value type is not compatible with * defaultValue type, the specified defaultValue is returned. Calling this method is equivalent to calling * {@code PropertyHelper.getValue(properties, key, defaultValue, (Class<T>) defaultValue.getClass())} * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param defaultValue Default value to be returned if the specified property is not set or cannot be read. * @param <T> Type of the property value. * @param legacyMap Legacy fallback map, where key is the actual property name, value is the old property name * @return Value of the property or defaultValue. */ public static <T> T getValue(Map<String, ?> properties, String key, T defaultValue, Map<String, String> legacyMap) { return getValue(properties, null, key, defaultValue, legacyMap); }
/** * Get the value of the specified property. * * If the property is not set or the actual property value type is not compatible with the specified type, the method will * return {@code null}. * * @param properties Map of properties to get the property value from. * @param propertyName Name of the property. * @param type Type to retrieve the value as. * @return Value of the property or {@code null}. * * @since 2.8 */ public static Object getValue(final Map<String, ?> properties, final String propertyName, final Class<?> type) { return PropertiesHelper.getValue(properties, propertyName, type, CommonProperties.LEGACY_FALLBACK_MAP); }
/** * Get the value of the specified property. * * If the property is not set or the real value type is not compatible with the specified value type, returns {@code null}. * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param type Type to retrieve the value as. * @param <T> Type of the property value. * @return Value of the property or {@code null}. * * @since 2.8 */ public static <T> T getValue(final Map<String, ?> properties, final String key, final Class<T> type) { return PropertiesHelper.getValue(properties, key, type, null); }
/** * Get the value of the specified property. * <p/> * If the property is not set or the actual property value type is not compatible with the specified type, the method will * return {@code null}. * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param type Type to retrieve the value as. * @param <T> Type of the property value. * @return Value of the property or {@code null}. * @since 2.8 */ public static <T> T getValue(final Map<String, ?> properties, final String key, final Class<T> type) { return PropertiesHelper.getValue(properties, key, type, null); } }
/** * Get the value of the specified property. * <p/> * If the property is not set or the real value type is not compatible with the specified value type, * returns {@code defaultValue}. * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param defaultValue Default value if property is not registered * @param type Type to retrieve the value as. * @param <T> Type of the property value. * @return Value of the property or {@code null}. * @since 2.8 */ public static <T> T getValue(final Map<String, ?> properties, final String key, final T defaultValue, final Class<T> type) { return PropertiesHelper.getValue(properties, key, defaultValue, type, null); }
/** * Get the value of the specified property. * <p/> * If the property is not set or the actual property value type is not compatible with the specified type, the method will * return {@code null}. * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param type Type to retrieve the value as. * @param <T> Type of the property value. * @return Value of the property or {@code null}. * @since 2.8 */ public static <T> T getValue(final Map<String, ?> properties, final String key, final Class<T> type) { return PropertiesHelper.getValue(properties, key, type, null); } }
/** * Get the value of the specified property. * * If the property is not set or the actual property value type is not compatible with the specified type, the method will * return {@code null}. * * @param properties Map of properties to get the property value from. * @param propertyName Name of the property. * @param type Type to retrieve the value as. * @return Value of the property or {@code null}. * * @since 2.8 */ public static Object getValue(final Map<String, ?> properties, final String propertyName, final Class<?> type) { return PropertiesHelper.getValue(properties, propertyName, type, CommonProperties.LEGACY_FALLBACK_MAP); }
/** * Get the value of the specified property. * <p/> * If the property is not set or the real value type is not compatible with the specified value type, * returns {@code defaultValue}. * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param defaultValue Default value if property is not registered * @param type Type to retrieve the value as. * @param <T> Type of the property value. * @return Value of the property or {@code null}. * @since 2.8 */ public static <T> T getValue(final Map<String, ?> properties, final String key, final T defaultValue, final Class<T> type) { return PropertiesHelper.getValue(properties, key, defaultValue, type, null); }
/** * Get the value of the specified property. * * If the property is not set or the real value type is not compatible with the specified value type, * returns {@code null}. * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param type Type to retrieve the value as. * @param <T> Type of the property value. * @return Value of the property or {@code null}. * * @since 2.8 */ public static <T> T getValue(final Map<String, ?> properties, final String key, final Class<T> type) { return PropertiesHelper.getValue(properties, key, type, null); }
/** * Get the value of the specified property. * * If the property is not set or the real value type is not compatible with the specified value type, * returns {@code null}. * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param type Type to retrieve the value as. * @param <T> Type of the property value. * @return Value of the property or {@code null}. * * @since 2.8 */ public static <T> T getValue(final Map<String, ?> properties, final String key, final Class<T> type) { return PropertiesHelper.getValue(properties, key, type, null); }
/** * Get the value of the specified property. * * If the property is not set or the real value type is not compatible with the specified value type, * returns {@code null}. * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param type Type to retrieve the value as. * @param <T> Type of the property value. * @return Value of the property or {@code null}. * * @since 2.8 */ public static <T> T getValue(Map<String, ?> properties, String key, Class<T> type) { return PropertiesHelper.getValue(properties, key, type, null); }
/** * Get the value of the specified property. * <p> * If the property is not set or the real value type is not compatible with * {@code defaultValue} type, the specified {@code defaultValue} is returned. Calling this method is equivalent to calling * <tt>ClientProperties.getValue(properties, key, defaultValue, (Class<T>) defaultValue.getClass())</tt>. * </p> * * @param properties Map of properties to get the property value from. * @param key Name of the property. * @param defaultValue Default value if property is not registered * @param <T> Type of the property value. * @return Value of the property or {@code null}. * @since 2.8 */ public static <T> T getValue(final Map<String, ?> properties, final String key, final T defaultValue) { return PropertiesHelper.getValue(properties, key, defaultValue, null); }
/** * Get output encoding from configuration. * @param configuration Configuration. * @param suffix Template processor suffix of the * to configuration property {@link org.glassfish.jersey.server.mvc.MvcFeature#ENCODING}. * * @return Encoding read from configuration properties or a default encoding if no encoding is configured. */ public static Charset getTemplateOutputEncoding(Configuration configuration, String suffix) { final String enc = PropertiesHelper.getValue(configuration.getProperties(), MvcFeature.ENCODING + suffix, String.class, null); if (enc == null) { return DEFAULT_ENCODING; } else { return Charset.forName(enc); } }
@Override public void configure(final FeatureContext context) { final Configuration config = context.getConfiguration(); if (context.getConfiguration().isRegistered(SseFeature.class)) { return; } if (!PropertiesHelper.getValue( config.getProperties(), config.getRuntimeType(), SseFeature.DISABLE_SSE, Boolean.FALSE, Boolean.class, null)) { context.register(SseFeature.class); } } }
/** * Creates a new instance of processor. * @param injectionManager injection manager. * @param monitoringEventListener Monitoring event listener. */ MonitoringStatisticsProcessor( final InjectionManager injectionManager, final MonitoringEventListener monitoringEventListener) { this.monitoringEventListener = monitoringEventListener; final ResourceModel resourceModel = injectionManager.getInstance(ExtendedResourceContext.class).getResourceModel(); this.statisticsBuilder = new MonitoringStatisticsImpl.Builder(resourceModel); this.statisticsCallbackList = injectionManager.getAllInstances(MonitoringStatisticsListener.class); this.scheduler = injectionManager.getInstance(ScheduledExecutorService.class, BackgroundSchedulerLiteral.INSTANCE); this.interval = PropertiesHelper.getValue(injectionManager.getInstance(Configuration.class).getProperties(), ServerProperties.MONITORING_STATISTICS_REFRESH_INTERVAL, DEFAULT_INTERVAL, Collections.<String, String>emptyMap()); }