Package de.xima.fc.gui.util
Class ComponentAttribute.Builder<T>
- java.lang.Object
-
- de.xima.fc.gui.util.ComponentAttribute.Builder<T>
-
- Type Parameters:
T- The expected type of the attribute value.
- Enclosing class:
- ComponentAttribute<T>
public static final class ComponentAttribute.Builder<T> extends Object
Builder for creating instances ofComponentAttributewith a fluent API for configuration.- Since:
- 8.5.3
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ComponentAttribute<T>build()Creates a newComponentAttributeinstance based on the configuration of this builder.ComponentAttribute.Builder<T>initialValue(Supplier<? extends T> initialValue)Sets the supplier for the initial value of the attribute.ComponentAttribute.Builder<T>throwOnMethodNotFound()Throws when invoking a method expression if no compatible method is found for the attribute.ComponentAttribute.Builder<T>throwOnMethodNotFound(boolean throwOnMethodNotFound)Sets whether to throw when invoking a method expression if no compatible method is found for the attribute.ComponentAttribute.Builder<T>throwOnMissingValue()Throws when getting the value of the attribute and no value is present (no value expression and no literal attribute).ComponentAttribute.Builder<T>throwOnMissingValue(boolean throwOnMissingValue)Whether to throw when getting the value of the attribute and no value is present (no value expression and no literal attribute).ComponentAttribute.Builder<T>throwOnNonNullValue()Throws when getting the value of the attribute and the resolved value is null.ComponentAttribute.Builder<T>throwOnNonNullValue(boolean throwOnNullValue)Whether to throw when getting the value of the attribute and the resolved value is null.ComponentAttribute.Builder<T>throwOnNonWritableProperty()Throws when trying to set a value for the attribute if no value expression is defined or the value expression does not refer to a writable property (no setter).ComponentAttribute.Builder<T>throwOnNonWritableProperty(boolean throwOnNonWritableProperty)Sets whether to throw when trying to set a value for the attribute if no value expression is defined or the value expression does not refer to a writable property (no setter).
-
-
-
Method Detail
-
build
public ComponentAttribute<T> build()
Creates a newComponentAttributeinstance based on the configuration of this builder.- Returns:
- A new ComponentAttribute instance.
-
initialValue
public ComponentAttribute.Builder<T> initialValue(Supplier<? extends T> initialValue)
Sets the supplier for the initial value of the attribute. When set, this value is used when getting the attribute and no value is currently present. Defaults to null (no initial value).- Parameters:
initialValue- The supplier for the initial value of the attribute.- Returns:
- This builder instance for method chaining.
-
throwOnMethodNotFound
public ComponentAttribute.Builder<T> throwOnMethodNotFound(boolean throwOnMethodNotFound)
Sets whether to throw when invoking a method expression if no compatible method is found for the attribute. Defaults to false.- Parameters:
throwOnMethodNotFound- Whether to throw when a method is not found.- Returns:
- This builder instance for method chaining.
-
throwOnMethodNotFound
public ComponentAttribute.Builder<T> throwOnMethodNotFound()
Throws when invoking a method expression if no compatible method is found for the attribute. Defaults to false.- Returns:
- This builder instance for method chaining.
-
throwOnMissingValue
public ComponentAttribute.Builder<T> throwOnMissingValue(boolean throwOnMissingValue)
Whether to throw when getting the value of the attribute and no value is present (no value expression and no literal attribute). This allows an existing value that just happens to be null. UsethrowOnNonNullValue()to forbid null values. Defaults to false.- Parameters:
throwOnMissingValue- Whether to throw when no value is present for the attribute.- Returns:
- This builder instance for method chaining.
-
throwOnMissingValue
public ComponentAttribute.Builder<T> throwOnMissingValue()
Throws when getting the value of the attribute and no value is present (no value expression and no literal attribute). This allows an existing value that just happens to be null. UsethrowOnNonNullValue()to forbid null values. Defaults to false.- Returns:
- This builder instance for method chaining.
-
throwOnNonNullValue
public ComponentAttribute.Builder<T> throwOnNonNullValue(boolean throwOnNullValue)
Whether to throw when getting the value of the attribute and the resolved value is null. Defaults to false.- Parameters:
throwOnNullValue- Whether to throw when the resolved value is null.- Returns:
- This builder instance for method chaining.
- See Also:
throwOnMissingValue()
-
throwOnNonNullValue
public ComponentAttribute.Builder<T> throwOnNonNullValue()
Throws when getting the value of the attribute and the resolved value is null. Defaults to false.- Returns:
- This builder instance for method chaining.
- See Also:
throwOnMissingValue()
-
throwOnNonWritableProperty
public ComponentAttribute.Builder<T> throwOnNonWritableProperty(boolean throwOnNonWritableProperty)
Sets whether to throw when trying to set a value for the attribute if no value expression is defined or the value expression does not refer to a writable property (no setter). Defaults to false.- Parameters:
throwOnNonWritableProperty- Whether to throw when trying to set a value for a non-writable property.- Returns:
- This builder instance for method chaining.
-
throwOnNonWritableProperty
public ComponentAttribute.Builder<T> throwOnNonWritableProperty()
Throws when trying to set a value for the attribute if no value expression is defined or the value expression does not refer to a writable property (no setter). Defaults to false.- Returns:
- This builder instance for method chaining.
-
-