Interface OptNullString<K>

All Superinterfaces:
BasicType<K>, OptBasicType<K>, OptNullType<K>

public interface OptNullString<K> extends OptNullType<K>
基本类型的getter接口抽象实现,所有类型的值获取都是通过将String转换而来 用户只需实现getStr方法即可,其他类型将会从String结果中转换 在不提供默认值的情况下, 如果值不存在或获取错误,返回null
Since:
Java 17+
Author:
Kimi Liu
  • Method Details

    • getObject

      default Object getObject(K key, Object defaultValue)
      Description copied from interface: OptBasicType
      获取Object属性值
      Specified by:
      getObject in interface OptBasicType<K>
      Parameters:
      key - 属性名
      defaultValue - 默认值
      Returns:
      属性值, 无对应值返回defaultValue
    • getInt

      default Integer getInt(K key, Integer defaultValue)
      Description copied from interface: OptBasicType
      获取int型属性值 若获得的值为不可见字符,使用默认值
      Specified by:
      getInt in interface OptBasicType<K>
      Parameters:
      key - 属性名
      defaultValue - 默认值
      Returns:
      属性值, 无对应值返回defaultValue
    • getShort

      default Short getShort(K key, Short defaultValue)
      Description copied from interface: OptBasicType
      获取short型属性值 若获得的值为不可见字符,使用默认值
      Specified by:
      getShort in interface OptBasicType<K>
      Parameters:
      key - 属性名
      defaultValue - 默认值
      Returns:
      属性值, 无对应值返回defaultValue
    • getBoolean

      default Boolean getBoolean(K key, Boolean defaultValue)
      Description copied from interface: OptBasicType
      获取boolean型属性值 若获得的值为不可见字符,使用默认值
      Specified by:
      getBoolean in interface OptBasicType<K>
      Parameters:
      key - 属性名
      defaultValue - 默认值
      Returns:
      属性值, 无对应值返回defaultValue
    • getLong

      default Long getLong(K key, Long defaultValue)
      Description copied from interface: OptBasicType
      获取Long型属性值 若获得的值为不可见字符,使用默认值
      Specified by:
      getLong in interface OptBasicType<K>
      Parameters:
      key - 属性名
      defaultValue - 默认值
      Returns:
      属性值, 无对应值返回defaultValue
    • getChar

      default Character getChar(K key, Character defaultValue)
      Description copied from interface: OptBasicType
      获取char型属性值 若获得的值为不可见字符,使用默认值
      Specified by:
      getChar in interface OptBasicType<K>
      Parameters:
      key - 属性名
      defaultValue - 默认值
      Returns:
      属性值, 无对应值返回defaultValue
    • getFloat

      default Float getFloat(K key, Float defaultValue)
      Description copied from interface: OptBasicType
      获取float型属性值 若获得的值为不可见字符,使用默认值
      Specified by:
      getFloat in interface OptBasicType<K>
      Parameters:
      key - 属性名
      defaultValue - 默认值
      Returns:
      属性值, 无对应值返回defaultValue
    • getDouble

      default Double getDouble(K key, Double defaultValue)
      Description copied from interface: OptBasicType
      获取double型属性值 若获得的值为不可见字符,使用默认值
      Specified by:
      getDouble in interface OptBasicType<K>
      Parameters:
      key - 属性名
      defaultValue - 默认值
      Returns:
      属性值, 无对应值返回defaultValue
    • getByte

      default Byte getByte(K key, Byte defaultValue)
      Description copied from interface: OptBasicType
      获取byte型属性值 若获得的值为不可见字符,使用默认值
      Specified by:
      getByte in interface OptBasicType<K>
      Parameters:
      key - 属性名
      defaultValue - 默认值
      Returns:
      属性值, 无对应值返回defaultValue
    • getBigDecimal

      default BigDecimal getBigDecimal(K key, BigDecimal defaultValue)
      Description copied from interface: OptBasicType
      获取BigDecimal型属性值 若获得的值为不可见字符,使用默认值
      Specified by:
      getBigDecimal in interface OptBasicType<K>
      Parameters:
      key - 属性名
      defaultValue - 默认值
      Returns:
      属性值, 无对应值返回defaultValue
    • getBigInteger

      default BigInteger getBigInteger(K key, BigInteger defaultValue)
      Description copied from interface: OptBasicType
      获取BigInteger型属性值 若获得的值为不可见字符,使用默认值
      Specified by:
      getBigInteger in interface OptBasicType<K>
      Parameters:
      key - 属性名
      defaultValue - 默认值
      Returns:
      属性值, 无对应值返回defaultValue
    • getEnum

      default <E extends Enum<E>> E getEnum(Class<E> clazz, K key, E defaultValue)
      Description copied from interface: OptBasicType
      获得Enum类型的值
      Specified by:
      getEnum in interface OptBasicType<K>
      Type Parameters:
      E - 枚举类型
      Parameters:
      clazz - Enum的Class
      key - KEY
      defaultValue - 默认值
      Returns:
      Enum类型的值, 无则返回Null
    • getDate

      default Date getDate(K key, Date defaultValue)
      Description copied from interface: OptBasicType
      获取Date类型值
      Specified by:
      getDate in interface OptBasicType<K>
      Parameters:
      key - 属性名
      defaultValue - 默认值
      Returns:
      Date类型属性值