Package org.apache.sshd.common
Interface Property<T>
-
- Type Parameters:
T- The generic property type
- All Superinterfaces:
NamedResource
- All Known Implementing Classes:
Property.BaseProperty,Property.BooleanProperty,Property.CharsetProperty,Property.DurationInSecondsProperty,Property.DurationProperty,Property.EnumProperty,Property.IntegerProperty,Property.LongProperty,Property.ObjectProperty,Property.StringProperty,Property.Validating
public interface Property<T> extends NamedResource
Property definition.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classProperty.BaseProperty<T>static classProperty.BooleanPropertystatic classProperty.CharsetPropertystatic classProperty.DurationInSecondsPropertystatic classProperty.DurationPropertystatic classProperty.EnumProperty<T extends java.lang.Enum<T>>static classProperty.IntegerPropertystatic classProperty.LongPropertystatic classProperty.ObjectPropertystatic classProperty.StringPropertystatic classProperty.Validating<T>
-
Field Summary
-
Fields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static Property<java.lang.Boolean>bool(java.lang.String name)static Property<java.lang.Boolean>bool(java.lang.String name, boolean def)static Property<java.nio.charset.Charset>charset(java.lang.String name)static Property<java.nio.charset.Charset>charset(java.lang.String name, java.nio.charset.Charset def)static Property<java.time.Duration>duration(java.lang.String name)static Property<java.time.Duration>duration(java.lang.String name, java.time.Duration def)static Property<java.time.Duration>duration(java.lang.String name, java.time.Duration def, java.time.Duration min)static Property<java.time.Duration>durationSec(java.lang.String name)static Property<java.time.Duration>durationSec(java.lang.String name, java.time.Duration def)static Property<java.time.Duration>durationSec(java.lang.String name, java.time.Duration def, java.time.Duration min)static <T extends java.lang.Enum<T>>
Property<T>enum_(java.lang.String name, java.lang.Class<T> type)static <T extends java.lang.Enum<T>>
Property<T>enum_(java.lang.String name, java.lang.Class<T> type, T def)java.util.Optional<T>get(PropertyResolver resolver)java.util.Optional<T>getDefault()TgetOrCustomDefault(PropertyResolver resolver, T defaultValue)default TgetOrNull(PropertyResolver resolver)default TgetRequired(PropertyResolver resolver)default TgetRequiredDefault()java.lang.Class<T>getType()static Property<java.lang.Integer>integer(java.lang.String name)static Property<java.lang.Integer>integer(java.lang.String name, int def)static Property<java.lang.Long>long_(java.lang.String name)static Property<java.lang.Long>long_(java.lang.String name, long def)static Property<java.lang.Object>object(java.lang.String name)static Property<java.lang.Object>object(java.lang.String name, java.lang.Object def)default voidremove(PropertyResolver resolver)voidset(PropertyResolver resolver, T value)static Property<java.lang.String>string(java.lang.String name)static Property<java.lang.String>string(java.lang.String name, java.lang.String def)static <T> Property<T>validating(Property<T> prop, java.util.function.Consumer<? super T> validator)-
Methods inherited from interface org.apache.sshd.common.NamedResource
getName
-
-
-
-
Method Detail
-
string
static Property<java.lang.String> string(java.lang.String name)
-
string
static Property<java.lang.String> string(java.lang.String name, java.lang.String def)
-
bool
static Property<java.lang.Boolean> bool(java.lang.String name)
-
bool
static Property<java.lang.Boolean> bool(java.lang.String name, boolean def)
-
integer
static Property<java.lang.Integer> integer(java.lang.String name)
-
integer
static Property<java.lang.Integer> integer(java.lang.String name, int def)
-
long_
static Property<java.lang.Long> long_(java.lang.String name)
-
long_
static Property<java.lang.Long> long_(java.lang.String name, long def)
-
enum_
static <T extends java.lang.Enum<T>> Property<T> enum_(java.lang.String name, java.lang.Class<T> type)
-
enum_
static <T extends java.lang.Enum<T>> Property<T> enum_(java.lang.String name, java.lang.Class<T> type, T def)
-
duration
static Property<java.time.Duration> duration(java.lang.String name)
-
duration
static Property<java.time.Duration> duration(java.lang.String name, java.time.Duration def)
-
duration
static Property<java.time.Duration> duration(java.lang.String name, java.time.Duration def, java.time.Duration min)
-
durationSec
static Property<java.time.Duration> durationSec(java.lang.String name)
-
durationSec
static Property<java.time.Duration> durationSec(java.lang.String name, java.time.Duration def)
-
durationSec
static Property<java.time.Duration> durationSec(java.lang.String name, java.time.Duration def, java.time.Duration min)
-
charset
static Property<java.nio.charset.Charset> charset(java.lang.String name)
-
charset
static Property<java.nio.charset.Charset> charset(java.lang.String name, java.nio.charset.Charset def)
-
object
static Property<java.lang.Object> object(java.lang.String name)
-
object
static Property<java.lang.Object> object(java.lang.String name, java.lang.Object def)
-
validating
static <T> Property<T> validating(Property<T> prop, java.util.function.Consumer<? super T> validator)
-
getType
java.lang.Class<T> getType()
- Returns:
- Property type - Note: for primitive types the wrapper equivalent is returned
-
getDefault
java.util.Optional<T> getDefault()
- Returns:
- The
Optionalpre-defined default value
-
getRequiredDefault
default T getRequiredDefault()
-
get
java.util.Optional<T> get(PropertyResolver resolver)
- Parameters:
resolver- ThePropertyResolverto query for the property value.- Returns:
- The
Optionalresult - if resolver contains a value then the resolver's value, otherwise the pre-defineddefault
-
getRequired
default T getRequired(PropertyResolver resolver)
- Parameters:
resolver- ThePropertyResolverto query for the property value.- Returns:
- The resolved value
- Throws:
java.util.NoSuchElementException- if resolver contains no value and nogetDefault()defined
-
getOrNull
default T getOrNull(PropertyResolver resolver)
- Parameters:
resolver- ThePropertyResolverto query for the property value.- Returns:
- The resolver's value or
nullif no specific value found in the resolver - regardless of whether there is a default value
-
getOrCustomDefault
T getOrCustomDefault(PropertyResolver resolver, T defaultValue)
- Parameters:
resolver- ThePropertyResolverto query for the property value.defaultValue- The default value to return if no specific value found in resolver- Returns:
- The resolver's value or specified default if no specific value found in the resolver - regardless of whether there is a default value
-
set
void set(PropertyResolver resolver, T value)
- Parameters:
resolver- ThePropertyResolverto update with the property value.value- The value to set
-
remove
default void remove(PropertyResolver resolver)
- Parameters:
resolver- ThePropertyResolverto remove the property from
-
-