com.vaadin.signals.
Interface SignalFactory
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Provides a signal instance based on a name. This encapsulates different strategies for creating instances that are e.g. synchronized across a cluster, shared within the same JVM, or isolated from any other instance.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SignalFactory
A signal factory that always returns a new instance that is not shared.
static final SignalFactory
A signal factory that always returns the same signal for the same name within the same JVM.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
clear()
Removes all name associations.
default <T> ListSignal<T>
Gets a list signal with the given element type for the given name.
default <T> MapSignal<T>
Gets a map signal with the given element type for the given name.
Gets a node signal for the given name.
default NumberSignal
Gets a number signal for the given name.
default NumberSignal
Gets a number signal for the given name and initializes it with the provided default value if the signal doesn't already have a value.
default void
Removes any previous association for the given name.
default <T> ValueSignal<T>
Gets a value signal of the given type for the given name.
default <T> ValueSignal<T>
Gets a value signal of the given type for the given name and initializes it with the provided default value if the signal doesn't already have a value.
default <T> ValueSignal<T>
Gets a value signal for the given name and initializes it with the provided default value if the signal doesn't already have a value.
-
Field Details
-
IN_MEMORY_EXCLUSIVE
A signal factory that always returns a new instance that is not shared. This factory does not support the optional removal methods.
-
IN_MEMORY_SHARED
A signal factory that always returns the same signal for the same name within the same JVM. This factory supports the optional removal methods.
-
-
Method Details
-
node
Gets a node signal for the given name.
Parameters:
name
- the name to use, notnull
Returns:
a node signal, not
null
-
value
Gets a value signal of the given type for the given name.
Type Parameters:
T
- the value typeParameters:
name
- the name to use, notnull
valueType
- the value type to use, notnull
Returns:
a value signal, not
null
-
value
Gets a value signal of the given type for the given name and initializes it with the provided default value if the signal doesn't already have a value. If the implementation returns an existing signal instance that already had a non-null value, then the provided default value is ignored.
Type Parameters:
T
- the value typeParameters:
name
- the name to use, notnull
valueType
- the value type to use, notnull
defaultValue
- the default value to use, notnull
Returns:
a value signal, not
null
-
value
Gets a value signal for the given name and initializes it with the provided default value if the signal doesn't already have a value. If the implementation returns an existing signal instance that already had a non-null value, then the provided default value is ignored. The signal value type is based on the type (
Object.getClass()
) of the default value instance.Type Parameters:
T
- the value typeParameters:
name
- the name to use, notnull
defaultValue
- the default value to use, notnull
Returns:
a value signal, not
null
-
number
Gets a number signal for the given name.
Parameters:
name
- the name to use, notnull
Returns:
a number signal, not
null
-
number
Gets a number signal for the given name and initializes it with the provided default value if the signal doesn't already have a value.
Parameters:
name
- the name to use, notnull
defaultValue
- the default value to useReturns:
a number signal, not
null
-
list
Gets a list signal with the given element type for the given name.
Type Parameters:
T
- the element typeParameters:
name
- the to use, notnull
elementType
- the element type, notnull
Returns:
a list signal, not
null
-
map
Gets a map signal with the given element type for the given name.
Type Parameters:
T
- the element typeParameters:
name
- the to use, notnull
elementType
- the element type, notnull
Returns:
a map signal, not
null
-
remove
Removes any previous association for the given name. Removing an association typically means that memory previously associated with the name is freed and a subsequent invocation with the same name will create a new signal.
This is an optional operation. Implementations that don't support removal throw
UnsupportedOperationException
.Parameters:
name
- the name to remove, notNullPointerException
Throws:
UnsupportedOperationException
- if this implementation doesn't support removal -
clear
Removes all name associations. Removing an association typically means that memory previously associated with the name is freed and a subsequent invocation with the same name will create a new signal.
This is an optional operation. Implementations that don't support clearing may throw
UnsupportedOperationException
.Throws:
UnsupportedOperationException
- if this implementation doesn't support clearing
-