@Test public void testPropertyNameDeclination() { String myProperty = "jersey.config.my.property"; String myClientProperty = "jersey.config.client.my.property"; String myServerProperty = "jersey.config.server.my.property"; String myNonJerseyProperty = "my.property"; assertEquals(myProperty, PropertiesHelper.getPropertyNameForRuntime(myProperty, null)); assertEquals(myClientProperty, PropertiesHelper.getPropertyNameForRuntime(myProperty, RuntimeType.CLIENT)); assertEquals(myServerProperty, PropertiesHelper.getPropertyNameForRuntime(myProperty, RuntimeType.SERVER)); assertEquals(myServerProperty, PropertiesHelper.getPropertyNameForRuntime(myServerProperty, RuntimeType.SERVER)); assertEquals(myServerProperty, PropertiesHelper.getPropertyNameForRuntime(myServerProperty, RuntimeType.CLIENT)); assertEquals(myClientProperty, PropertiesHelper.getPropertyNameForRuntime(myClientProperty, RuntimeType.SERVER)); assertEquals(myClientProperty, PropertiesHelper.getPropertyNameForRuntime(myClientProperty, RuntimeType.CLIENT)); assertEquals(myNonJerseyProperty, PropertiesHelper.getPropertyNameForRuntime(myNonJerseyProperty, RuntimeType.CLIENT)); assertEquals(myNonJerseyProperty, PropertiesHelper.getPropertyNameForRuntime(myNonJerseyProperty, RuntimeType.CLIENT)); assertEquals(myNonJerseyProperty, PropertiesHelper.getPropertyNameForRuntime(myNonJerseyProperty, null)); }
public static String getPropertyNameForRuntime(String key, RuntimeType runtimeType) { if (runtimeType != null && key.startsWith("jersey.config")) { RuntimeType[] types = RuntimeType.values(); for (RuntimeType type : types) { if (key.startsWith("jersey.config." + type.name().toLowerCase())) { return key; } } return key.replace("jersey.config", "jersey.config." + runtimeType.name().toLowerCase()); } return key; }
PropertiesHelper { public static String getPropertyNameForRuntime(String key, RuntimeType runtimeType) { if (runtimeType != null && key.startsWith("jersey.config")) { RuntimeType[] types = RuntimeType.values(); for (RuntimeType type : types) { if (key.startsWith("jersey.config." + type.name().toLowerCase())) { return key; } } return key.replace("jersey.config", "jersey.config." + runtimeType.name().toLowerCase()); } return key; } }
PropertiesHelper { public static String getPropertyNameForRuntime(String key, RuntimeType runtimeType) { if (runtimeType != null && key.startsWith("jersey.config")) { RuntimeType[] types = RuntimeType.values(); for (RuntimeType type : types) { if (key.startsWith("jersey.config." + type.name().toLowerCase())) { return key; } } return key.replace("jersey.config", "jersey.config." + runtimeType.name().toLowerCase()); } return key; } private  PropertiesHelper(); }
PropertiesHelper { public static String getPropertyNameForRuntime(String key, RuntimeType runtimeType) { if (runtimeType != null && key.startsWith("jersey.config")) { RuntimeType[] types = RuntimeType.values(); for (RuntimeType type : types) { if (key.startsWith("jersey.config." + type.name().toLowerCase())) { return key; } } return key.replace("jersey.config", "jersey.config." + runtimeType.name().toLowerCase()); } return key; } private  PropertiesHelper(); static PrivilegedAction<Properties> getSystemProperties(); static PrivilegedAction<String> getSystemProperty(final String name); static PrivilegedAction<String> getSystemProperty(final String name, final String def); static T getValue(Map<String, ?> properties, String key, T defaultValue, Map<String, String> legacyMap); @SuppressWarnings("unchecked") static T getValue(Map<String, ?> properties,
                                 RuntimeType runtimeType,
                                 String key,
                                 T defaultValue,
                                 Map<String, String> legacyMap); static T getValue(Map<String, ?> properties,
                                 String key,
                                 T defaultValue,
                                 Class<T> type,
                                 Map<String, String> legacyMap); static T getValue(Map<String, ?> properties, RuntimeType runtimeType, String key,
                                 T defaultValue, Class<T> type, Map<String, String> legacyMap); static T getValue(Map<String, ?> properties, String key, Class<T> type, Map<String, String> legacyMap); static T getValue(Map<String, ?> properties, RuntimeType runtimeType, String key, Class<T> type,
                                 Map<String, String> legacyMap); static String getPropertyNameForRuntime(String key, RuntimeType runtimeType); static T convertValue(Object value, Class<T> type); static boolean isProperty(final Map<String, Object> properties, final String name); static boolean isProperty(final Object value); }
PropertiesHelper { public static String getPropertyNameForRuntime(String key, RuntimeType runtimeType) { if (runtimeType != null && key.startsWith("jersey.config")) { RuntimeType[] types = RuntimeType.values(); for (RuntimeType type : types) { if (key.startsWith("jersey.config." + type.name().toLowerCase())) { return key; } } return key.replace("jersey.config", "jersey.config." + runtimeType.name().toLowerCase()); } return key; } private  PropertiesHelper(); static PrivilegedAction<Properties> getSystemProperties(); static PrivilegedAction<String> getSystemProperty(final String name); static PrivilegedAction<String> getSystemProperty(final String name, final String def); static T getValue(Map<String, ?> properties, String key, T defaultValue, Map<String, String> legacyMap); @SuppressWarnings("unchecked") static T getValue(Map<String, ?> properties,
                                 RuntimeType runtimeType,
                                 String key,
                                 T defaultValue,
                                 Map<String, String> legacyMap); static T getValue(Map<String, ?> properties,
                                 String key,
                                 T defaultValue,
                                 Class<T> type,
                                 Map<String, String> legacyMap); static T getValue(Map<String, ?> properties, RuntimeType runtimeType, String key,
                                 T defaultValue, Class<T> type, Map<String, String> legacyMap); static T getValue(Map<String, ?> properties, String key, Class<T> type, Map<String, String> legacyMap); static T getValue(Map<String, ?> properties, RuntimeType runtimeType, String key, Class<T> type,
                                 Map<String, String> legacyMap); static String getPropertyNameForRuntime(String key, RuntimeType runtimeType); static T convertValue(Object value, Class<T> type); static boolean isProperty(final Map<String, Object> properties, final String name); static boolean isProperty(final Object value);  }