KEYTYPE - The key type. E.g. String etc.@FunctionalInterface public interface IGetterByKeyTrait<KEYTYPE>
| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
s_aTraitLogger |
| Modifier and Type | Method and Description |
|---|---|
default boolean |
containsNonNullValue(KEYTYPE aKey) |
default boolean |
containsNullValue(KEYTYPE aKey) |
default BigDecimal |
getAsBigDecimal(KEYTYPE aKey) |
default BigDecimal |
getAsBigDecimal(KEYTYPE aKey,
BigDecimal aDefault) |
default BigInteger |
getAsBigInteger(KEYTYPE aKey) |
default BigInteger |
getAsBigInteger(KEYTYPE aKey,
BigInteger aDefault) |
default boolean |
getAsBoolean(KEYTYPE aKey) |
default boolean |
getAsBoolean(KEYTYPE aKey,
boolean bDefault) |
default Boolean |
getAsBooleanObj(KEYTYPE aKey) |
default byte |
getAsByte(KEYTYPE aKey) |
default byte |
getAsByte(KEYTYPE aKey,
byte nDefault) |
default byte[] |
getAsByteArray(KEYTYPE aKey) |
default Byte |
getAsByteObj(KEYTYPE aKey) |
default char |
getAsChar(KEYTYPE aKey) |
default char |
getAsChar(KEYTYPE aKey,
char cDefault) |
default char[] |
getAsCharArray(KEYTYPE aKey) |
default char[] |
getAsCharArray(KEYTYPE aKey,
char[] aDefault) |
default Character |
getAsCharObj(KEYTYPE aKey) |
default double |
getAsDouble(KEYTYPE aKey) |
default double |
getAsDouble(KEYTYPE aKey,
double dDefault) |
default Double |
getAsDoubleObj(KEYTYPE aKey) |
default float |
getAsFloat(KEYTYPE aKey) |
default float |
getAsFloat(KEYTYPE aKey,
float fDefault) |
default Float |
getAsFloatObj(KEYTYPE aKey) |
default int |
getAsInt(KEYTYPE aKey) |
default int |
getAsInt(KEYTYPE aKey,
int nDefault) |
default Integer |
getAsIntObj(KEYTYPE aKey) |
default LocalDate |
getAsLocalDate(KEYTYPE aKey) |
default LocalDate |
getAsLocalDate(KEYTYPE aKey,
LocalDate aDefault) |
default LocalDate |
getAsLocalDate(KEYTYPE aKey,
Locale aContentLocale)
Get the value as a String, interpreted as a
LocalDate. |
default LocalDateTime |
getAsLocalDateTime(KEYTYPE aKey) |
default LocalDateTime |
getAsLocalDateTime(KEYTYPE aKey,
LocalDateTime aDefault) |
default LocalDateTime |
getAsLocalDateTime(KEYTYPE aKey,
Locale aContentLocale)
Get the value as a String, interpreted as a
LocalDateTime. |
default LocalTime |
getAsLocalTime(KEYTYPE aKey) |
default LocalTime |
getAsLocalTime(KEYTYPE aKey,
Locale aContentLocale)
Get the value as a String, interpreted as a
LocalTime. |
default LocalTime |
getAsLocalTime(KEYTYPE aKey,
LocalTime aDefault) |
default long |
getAsLong(KEYTYPE aKey) |
default long |
getAsLong(KEYTYPE aKey,
long nDefault) |
default Long |
getAsLongObj(KEYTYPE aKey) |
default short |
getAsShort(KEYTYPE aKey) |
default short |
getAsShort(KEYTYPE aKey,
short nDefault) |
default Short |
getAsShortObj(KEYTYPE aKey) |
default Blob |
getAsSqlBlob(KEYTYPE aKey) |
default Clob |
getAsSqlClob(KEYTYPE aKey) |
default Date |
getAsSqlDate(KEYTYPE aKey) |
default NClob |
getAsSqlNClob(KEYTYPE aKey) |
default RowId |
getAsSqlRowId(KEYTYPE aKey) |
default Time |
getAsSqlTime(KEYTYPE aKey) |
default Timestamp |
getAsSqlTimestamp(KEYTYPE aKey) |
default String |
getAsString(KEYTYPE aKey) |
default String |
getAsString(KEYTYPE aKey,
String sDefault) |
default ICommonsList<String> |
getAsStringList(KEYTYPE aKey)
Get a list of all attribute values with the same name.
|
default ICommonsList<String> |
getAsStringList(KEYTYPE aKey,
ICommonsList<String> aDefault)
Get a list of all attribute values with the same name.
|
default ICommonsOrderedSet<String> |
getAsStringSet(KEYTYPE aKey)
Get a set of all attribute values with the same name.
|
default ICommonsOrderedSet<String> |
getAsStringSet(KEYTYPE aKey,
ICommonsOrderedSet<String> aDefault)
Get a set of all attribute values with the same name.
|
default <T> T |
getCastedValue(KEYTYPE aKey)
Get the contained value casted to the return type.
|
default <T> T |
getCastedValue(KEYTYPE aKey,
Class<T> aClass)
Get the contained value casted to the specified class.
|
default <T> T |
getCastedValue(KEYTYPE aKey,
T aDefault)
Get the contained value casted to the return type.
|
default <T> T |
getCastedValue(KEYTYPE aKey,
T aDefault,
Class<T> aClass)
Get the contained value casted to the specified class.
|
default <T> T |
getConvertedValue(KEYTYPE aKey,
Class<T> aClass)
Get the contained value converted using TypeConverter to the passed class.
|
default <T> T |
getConvertedValue(KEYTYPE aKey,
T aDefault,
Class<T> aClass)
Get the contained value converted using TypeConverter to the passed class.
|
default <T> T |
getSafeCastedValue(KEYTYPE aKey,
Class<T> aClass)
Get the contained value casted to the specified class, but only if the cast
is possible.
|
default <T> T |
getSafeCastedValue(KEYTYPE aKey,
T aDefault,
Class<T> aClass)
Get the contained value casted to the specified class, but only if the cast
is possible.
|
Object |
getValue(KEYTYPE aKey)
Get the value matching the provided key.
|
default Class<?> |
getValueClass(KEYTYPE aKey) |
default boolean |
hasStringValue(KEYTYPE aKey,
String sDesiredValue)
Check if a attribute with the given name is present in the request and has
the specified value.
|
default boolean |
hasStringValue(KEYTYPE aKey,
String sDesiredValue,
boolean bDefault)
Check if a attribute with the given name is present in the request and has
the specified value.
|
@Nullable Object getValue(@Nullable KEYTYPE aKey)
aKey - The key to query. May be null.null constraints
applicable.@Nullable default Class<?> getValueClass(@Nullable KEYTYPE aKey)
aKey - The key to be accessed. May be null.null if no value is
contained.default boolean containsNonNullValue(@Nullable KEYTYPE aKey)
aKey - The key to be accessed. May be null.true if the value is not null. Same as
getValue()!=null.default boolean containsNullValue(@Nullable KEYTYPE aKey)
aKey - The key to be accessed. May be null.true if the value is null. Same as
getValue()==null.@Nullable default <T> T getCastedValue(@Nullable KEYTYPE aKey) throws ClassCastException
T - Destination typeaKey - The key to be accessed. May be null.null if the contained value is null.ClassCastException - in case the value types are not convertible@Nullable default <T> T getCastedValue(@Nullable KEYTYPE aKey, @Nullable T aDefault) throws ClassCastException
T - Destination typeaKey - The key to be accessed. May be null.aDefault - The value to be returned if the retrieved value is null
.null if the contained value is null.ClassCastException - in case the value types are not convertible@Nullable default <T> T getCastedValue(@Nullable KEYTYPE aKey, @Nonnull Class<T> aClass) throws ClassCastException
T - Destination typeaKey - The key to be accessed. May be null.aClass - The class to cast to.null if the contained value is null.ClassCastException - in case the value types are not convertible@Nullable default <T> T getCastedValue(@Nullable KEYTYPE aKey, @Nullable T aDefault, @Nonnull Class<T> aClass) throws ClassCastException
T - Destination typeaKey - The key to be accessed. May be null.aDefault - The value to be returned if the retrieved value is null
.aClass - The class to cast to.null if the contained value is null.ClassCastException - in case the value types are not convertible@Nullable default <T> T getSafeCastedValue(@Nullable KEYTYPE aKey, @Nonnull Class<T> aClass)
T - Destination typeaKey - The key to be accessed. May be null.aClass - The class to cast to.null if the contained value is null.ClassCastException - in case the value types are not convertiblegetSafeCastedValue(Object, Object, Class)@Nullable default <T> T getSafeCastedValue(@Nullable KEYTYPE aKey, @Nullable T aDefault, @Nonnull Class<T> aClass)
T - Destination typeaKey - The key to be accessed. May be null.aDefault - The value to be returned if the retrieved value is null
.aClass - The class to cast to.null if the contained value is null.ClassCastException - in case the value types are not convertiblegetSafeCastedValue(Object, Class)@Nullable default <T> T getConvertedValue(@Nullable KEYTYPE aKey, @Nonnull Class<T> aClass)
T - Destination typeaKey - The key to be accessed. May be null.aClass - The class to convert to.null if the contained value is null.TypeConverterException - in case of an error@Nullable default <T> T getConvertedValue(@Nullable KEYTYPE aKey, @Nullable T aDefault, @Nonnull Class<T> aClass)
T - Destination typeaKey - The key to be accessed. May be null.aDefault - The value to be returned if the retrieved value is null
.aClass - The class to convert to.null if the contained value is null.TypeConverterException - in case of an errordefault boolean getAsBoolean(@Nullable KEYTYPE aKey) throws TypeConverterException
TypeConverterExceptiondefault byte getAsByte(@Nullable KEYTYPE aKey) throws TypeConverterException
TypeConverterExceptiondefault char getAsChar(@Nullable KEYTYPE aKey) throws TypeConverterException
TypeConverterExceptiondefault double getAsDouble(@Nullable KEYTYPE aKey) throws TypeConverterException
TypeConverterExceptiondefault float getAsFloat(@Nullable KEYTYPE aKey) throws TypeConverterException
TypeConverterExceptiondefault int getAsInt(@Nullable KEYTYPE aKey) throws TypeConverterException
TypeConverterExceptiondefault long getAsLong(@Nullable KEYTYPE aKey) throws TypeConverterException
TypeConverterExceptiondefault short getAsShort(@Nullable KEYTYPE aKey) throws TypeConverterException
TypeConverterException@Nullable default String getAsString(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,String.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default String getAsString(@Nullable KEYTYPE aKey, @Nullable String sDefault) throws TypeConverterException
aKey - The key to be accessed. May be null.sDefault - The value to be returned if the retrieved value is null
.getConvertedValue (aKey,sDefault, String.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Object,Class)@Nullable default char[] getAsCharArray(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,char [].class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default char[] getAsCharArray(@Nullable KEYTYPE aKey, @Nullable char[] aDefault) throws TypeConverterException
aKey - The key to be accessed. May be null.aDefault - The value to be returned if the retrieved value is null
.getConvertedValue (aKey, aDefault, char[].class)TypeConverterException - in case of an errorgetConvertedValue(Object,Object,Class)@Nullable default BigDecimal getAsBigDecimal(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,BigDecimal.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default BigDecimal getAsBigDecimal(@Nullable KEYTYPE aKey, @Nullable BigDecimal aDefault) throws TypeConverterException
aKey - The key to be accessed. May be null.aDefault - The value to be returned if the retrieved value is null
.getConvertedValue (aKey,aDefault,BigDecimal.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Object,Class)@Nullable default BigInteger getAsBigInteger(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,BigInteger.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default BigInteger getAsBigInteger(@Nullable KEYTYPE aKey, @Nullable BigInteger aDefault) throws TypeConverterException
aKey - The key to be accessed. May be null.aDefault - The value to be returned if the retrieved value is null
.getConvertedValue (aKey,aDefault,BigInteger.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Object, Class)@Nullable default LocalDate getAsLocalDate(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,LocalDate.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default LocalDate getAsLocalDate(@Nullable KEYTYPE aKey, @Nullable LocalDate aDefault) throws TypeConverterException
aKey - The key to be accessed. May be null.aDefault - The value to be returned if the retrieved value is null
.getConvertedValue (aKey,aDefault,LocalDate.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Object,Class)@Nullable default LocalTime getAsLocalTime(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,LocalTime.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default LocalTime getAsLocalTime(@Nullable KEYTYPE aKey, @Nullable LocalTime aDefault) throws TypeConverterException
aKey - The key to be accessed. May be null.aDefault - The value to be returned if the retrieved value is null
.getConvertedValue (aKey,aDefault,LocalTime.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Object,Class)@Nullable default LocalDateTime getAsLocalDateTime(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,LocalDateTime.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default LocalDateTime getAsLocalDateTime(@Nullable KEYTYPE aKey, @Nullable LocalDateTime aDefault) throws TypeConverterException
aKey - The key to be accessed. May be null.aDefault - The value to be returned if the retrieved value is null
.getConvertedValue (aKey,aDefault,LocalDateTime.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Object,Class)@Nullable default byte[] getAsByteArray(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,byte[].class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Boolean getAsBooleanObj(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Boolean.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Byte getAsByteObj(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Byte.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Character getAsCharObj(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Character.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Double getAsDoubleObj(@Nullable KEYTYPE aKey)
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Double.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Float getAsFloatObj(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Float.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Integer getAsIntObj(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Integer.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Long getAsLongObj(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Long.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Short getAsShortObj(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Short.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Blob getAsSqlBlob(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Blob.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Clob getAsSqlClob(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Clob.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Date getAsSqlDate(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Date.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default NClob getAsSqlNClob(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,NClob.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default RowId getAsSqlRowId(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,RowId.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Time getAsSqlTime(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Time.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default Timestamp getAsSqlTimestamp(@Nullable KEYTYPE aKey) throws TypeConverterException
aKey - The key to be accessed. May be null.getConvertedValue (aKey,Timestamp.class)TypeConverterException - in case of an errorgetConvertedValue(Object,Class)@Nullable default LocalDate getAsLocalDate(@Nullable KEYTYPE aKey, @Nonnull Locale aContentLocale)
LocalDate.aKey - The key to check. May be null.aContentLocale - Locale to use for conversion.null if either the conversion to String or the parsing
of the String failed.@Nullable default LocalTime getAsLocalTime(@Nullable KEYTYPE aKey, @Nonnull Locale aContentLocale)
LocalTime.aKey - The key to check. May be null.aContentLocale - Locale to use for conversion.null if either the conversion to String or the parsing
of the String failed.@Nullable default LocalDateTime getAsLocalDateTime(@Nullable KEYTYPE aKey, @Nonnull Locale aContentLocale)
LocalDateTime.aKey - The key to check. May be null.aContentLocale - Locale to use for conversion.null if either the conversion to String or the parsing
of the String failed.@Nullable default ICommonsList<String> getAsStringList(@Nullable KEYTYPE aKey)
aKey - The key to check. May be null.null if no such attribute value exists@Nullable default ICommonsList<String> getAsStringList(@Nullable KEYTYPE aKey, @Nullable ICommonsList<String> aDefault)
aKey - The key to check. May be null.aDefault - The default value to be returned, if no such attribute is present.aDefault if no such attribute value exists@Nullable default ICommonsOrderedSet<String> getAsStringSet(@Nullable KEYTYPE aKey)
aKey - The key to check. May be null.null if no such attribute value exists@Nullable default ICommonsOrderedSet<String> getAsStringSet(@Nullable KEYTYPE aKey, @Nullable ICommonsOrderedSet<String> aDefault)
aKey - The key to check. May be null.aDefault - The default value to be returned, if no such attribute is present.aDefault if no such attribute value existsdefault boolean hasStringValue(@Nullable KEYTYPE aKey, @Nullable String sDesiredValue)
aKey - The key to check. May be null.sDesiredValue - The value to be matchedtrue if an attribute with the given name is present
and has the desired valuedefault boolean hasStringValue(@Nullable KEYTYPE aKey, @Nullable String sDesiredValue, boolean bDefault)
aKey - The key to check. May be null.sDesiredValue - The value to be matchedbDefault - the default value to be returned, if the specified attribute is not
presenttrue if an attribute with the given name is present
and has the desired value, false if the attribute is
present but has a different value. If the attribute is not present,
the default value is returned.Copyright © 2014–2017 Philip Helger. All rights reserved.