Interface PropertyValueSource

    • Method Detail

      • getProperties

        java.util.Collection<Property<?>> getProperties()
      • getValues

        default java.util.List<PropertyValue> getValues()
        Returns the opaque PropertyValue objects. This can be useful when you want to avoid the strict type checking of the value, and it's important to note that if the property is bound, the value will be a BoundValue. Be very careful about overriding, and make sure to maintain the methodology of using getProperties to iterate and get (or getOrDefault), to get the value, because those are all handled differently by BoundPropertySets, ExtendedPropertySets, etc.
      • get

        @Nullable
        <T> T get​(Property<T> prop)
        Retrieves the value of the property, or null if this set doesn't contain that property.
      • contains

        boolean contains​(Property<?> prop)
        Returns:
        True if the source contains a value for prop.
      • getOrDefault

        @Nullable
        <T> T getOrDefault​(Property<T> prop)
        Returns:
        The value for prop or Property.getDefaultValue() if not present. Can return null if the value is null.
      • getOrElse

        @Nullable
        <T> T getOrElse​(Property<T> prop,
                        T value)
        Get the value for a given Property, or else fall back to value if it's not present.
        Parameters:
        prop - The Property for which a value is to be retrieved.
        value - The value to default to if property isn't present.
        Returns:
        The value of property if present, value if not. Can return null if the value is null.
      • getNonNull

        @Nonnull
        default <T> T getNonNull​(Property<T> prop,
                                 @Nonnull
                                 T value)
        The value for prop if it exists and is not null. Otherwise returns Property.getDefaultValue() if that exists and is not null. Finally will fallback to value.
        Parameters:
        prop - The Property for which a value is to be retrieved.
        value - The value to default to if property isn't present or returns null and has no default.
        Returns:
        The value of property if present and non-null, otherwise Property.getDefaultValue() if non-null, otherwise value if neither is present and non-null
      • getNonNull

        @Nonnull
        default <T> T getNonNull​(Property<T> prop,
                                 @Nonnull
                                 java.util.function.Supplier<T> supplier)
        The value for prop if it exists and is not null. Otherwise returns Property.getDefaultValue() if that exists and is not null. Finally will fallback to value.
        Parameters:
        prop - The Property for which a value is to be retrieved.
        supplier - The supplier of a default value to use if property isn't present or returns null and has no default. Supplier must not return null.
        Returns:
        The value of property if present and non-null, otherwise Property.getDefaultValue() if non-null, otherwise value if neither is present and non-null