java.lang.Object
church.i18n.processing.message.ContextValue
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionContextValue(@Nullable Serializable value) Constructor of a value without specifying a type.ContextValue(@Nullable Serializable value, @Nullable ValueType valueType) Constructor of a value with its type.ContextValue(@Nullable Serializable value, @Nullable String valueType) Constructor of a value with its type. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic <C> @NotNull ContextValuefromCollection(@Nullable Collection<C> collection, @NotNull ValueType type) Constructs aContextValuefrom collection and assign the type of collection.static <E extends Enum<E>>
@NotNull ContextValueConstructs aContextValuefrom all enumeration values.static <E extends Enum<E>>
@NotNull ContextValueConstructs aContextValuefrom listed enum values.static <L> @NotNull ContextValueConstructs aContextValuefrom list of values.static <K,V> @NotNull ContextValue Constructs aContextValuefrom map of key-value entries.static <S> @NotNull ContextValueConstructs aContextValuefrom set of values.@Nullable ObjectgetValue()Get assigned value.@Nullable StringGet assigned value type.inthashCode()@NotNull StringtoString()
-
Constructor Details
-
ContextValue
public ContextValue(@Nullable @Nullable Serializable value, @Nullable @Nullable ValueType valueType) Constructor of a value with its type.- Parameters:
value- Value or data you want to assign.valueType- The type of thevalueargument you have provided. For example whenvalueis string you may specify what type of data it carries, e.g. List, Enum, Regular expression or so. When it is an object you can closely specify what format of object it is — e.g., JSON, XML.
-
ContextValue
Constructor of a value with its type.- Parameters:
value- Value or data you want to assign.valueType- The type of thevalueargument you have provided. For example whenvalueis string you may specify what type of data it carries, e.g. List, Enum, Regular expression or so. When it is an object you can closely specify what format of object it is — e.g., JSON, XML.
-
ContextValue
Constructor of a value without specifying a type.- Parameters:
value- Value or data you want to assign.
-
-
Method Details
-
fromCollection
@NotNull public static <C> @NotNull ContextValue fromCollection(@Nullable @Nullable Collection<C> collection, @NotNull @NotNull ValueType type) Constructs aContextValuefrom collection and assign the type of collection.- Type Parameters:
C- Type of objects in the collection.- Parameters:
collection- Collections of values.type- Type of a collection.- Returns:
- A
ContextValuewith collection values and it's type.
-
fromEnum
@NotNull public static <E extends Enum<E>> @NotNull ContextValue fromEnum(@Nullable @Nullable Class<E> enumeration) Constructs aContextValuefrom all enumeration values.- Type Parameters:
E- Enum type.- Parameters:
enumeration- Enum to use.- Returns:
- A
ContextValuewith array of all enum values and as value typeValueType.ENUMis used.
-
fromEnum
@SafeVarargs @NotNull public static <E extends Enum<E>> @NotNull ContextValue fromEnum(@Nullable @Nullable Enum<E>... enumeration) Constructs aContextValuefrom listed enum values.- Type Parameters:
E- Enum type.- Parameters:
enumeration- List of enum values to use (Could be only subset of the enum)- Returns:
- A
ContextValuewith array of listed enum values and as value typeValueType.ENUMis used.
-
fromList
Constructs aContextValuefrom list of values.- Type Parameters:
L- Type of objects in the list.- Parameters:
list- List of values to use.- Returns:
- A
ContextValuewith array of list values and as value typeValueType.LISTis used.
-
fromMap
Constructs aContextValuefrom map of key-value entries.- Type Parameters:
K- Type of map keys.V- Type of values in the map.- Parameters:
map- Map of key-pair entries to use.- Returns:
- A
ContextValuewith all map key-value entries and as value typeValueType.MAPis used.
-
fromSet
Constructs aContextValuefrom set of values.- Type Parameters:
S- Type of objects in the set.- Parameters:
set- Set of values to use.- Returns:
- A
ContextValuewith array of set values and as value typeValueType.SETis used.
-
getValue
Get assigned value.- Returns:
- Assigned value.
-
getValueType
Get assigned value type.- Returns:
- Assigned value type.
-
hashCode
public int hashCode() -
equals
-
toString
-