/** * @param resolver The {@link PropertyResolver} instance * @param name The property name * @param value The new value - if {@code null} or an empty {@link CharSequence} * the property is <U>removed</U> * @return The previous value - {@code null} if none */ public static Object updateProperty(PropertyResolver resolver, String name, Object value) { return updateProperty(resolver.getProperties(), name, value); }
/** * @param resolver The {@link PropertyResolver} instance * @param name The property name * @param value The new value - if {@code null} or an empty {@link CharSequence} * the property is <U>removed</U> * @return The previous value - {@code null} if none */ public static Object updateProperty(PropertyResolver resolver, String name, Object value) { return updateProperty(resolver.getProperties(), name, value); }
public static Object updateProperty(PropertyResolver resolver, String name, long value) { return updateProperty(resolver.getProperties(), name, value); }
public static Object updateProperty(PropertyResolver resolver, String name, boolean value) { return updateProperty(resolver.getProperties(), name, value); }
public static Object updateProperty(PropertyResolver resolver, String name, long value) { return updateProperty(resolver.getProperties(), name, value); }
public static Object updateProperty(PropertyResolver resolver, String name, int value) { return updateProperty(resolver.getProperties(), name, value); }
public static Object updateProperty(PropertyResolver resolver, String name, int value) { return updateProperty(resolver.getProperties(), name, value); }
public static Object updateProperty(PropertyResolver resolver, String name, boolean value) { return updateProperty(resolver.getProperties(), name, value); }
/** * Unwinds the resolvers hierarchy until found one with a non-{@code null} value * for the requested property or reached top. * * @param resolver The {@link PropertyResolver} to start from - ignored if {@code null} * @param name The requested property name * @return The found properties {@link Map} or {@code null} */ public static Map<String, Object> resolvePropertiesSource(PropertyResolver resolver, String name) { String key = ValidateUtils.checkNotNullAndNotEmpty(name, "No property name"); for (PropertyResolver r = resolver; r != null; r = r.getParentPropertyResolver()) { Map<String, Object> props = r.getProperties(); if (props != null) { Object value = props.get(key); if (value != null) { return props; } } } return null; }
/** * Unwinds the resolvers hierarchy until found one with a non-{@code null} value * for the requested property or reached top. If still no value found and the key * starts with "org.apache.sshd" then the system properties are also * consulted * * @param resolver The {@link PropertyResolver} to start from - ignored if {@code null} * @param name The requested property name * @return The found value or {@code null} */ public static Object resolvePropertyValue(PropertyResolver resolver, String name) { String key = ValidateUtils.checkNotNullAndNotEmpty(name, "No property name"); for (PropertyResolver r = resolver; r != null; r = r.getParentPropertyResolver()) { Map<String, ?> props = r.getProperties(); if (props != null) { Object value = props.get(key); if (value != null) { return value; } } } return null; }
/** * Unwinds the resolvers hierarchy until found one with a non-{@code null} value * for the requested property or reached top. * * @param resolver The {@link PropertyResolver} to start from - ignored if {@code null} * @param name The requested property name * @return The found properties {@link Map} or {@code null} */ public static Map<String, Object> resolvePropertiesSource(PropertyResolver resolver, String name) { String key = ValidateUtils.checkNotNullAndNotEmpty(name, "No property name"); for (PropertyResolver r = resolver; r != null; r = r.getParentPropertyResolver()) { Map<String, Object> props = r.getProperties(); Object value = getObject(props, key); if (value != null) { return props; } } return null; }
/** * Unwinds the resolvers hierarchy until found one with a non-{@code null} value * for the requested property or reached top. If still no value found and the key * starts with "org.apache.sshd" then the system properties are also * consulted * * @param resolver The {@link PropertyResolver} to start from - ignored if {@code null} * @param name The requested property name * @return The found value or {@code null} */ public static Object resolvePropertyValue(PropertyResolver resolver, String name) { String key = ValidateUtils.checkNotNullAndNotEmpty(name, "No property name"); for (PropertyResolver r = resolver; r != null; r = r.getParentPropertyResolver()) { Map<String, ?> props = r.getProperties(); Object value = getObject(props, key); if (value != null) { return value; } } return null; }