public class ValueWithComments extends Object
Property.toExportValue(T).
Prefer defining comments in SettingsHolder classes whenever your comments can be statically
defined.
| Constructor and Description |
|---|
ValueWithComments(@NotNull Object value,
@NotNull List<String> comments)
Constructor.
|
ValueWithComments(@NotNull Object value,
@NotNull List<String> comments,
@Nullable UUID uniqueCommentId)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
@NotNull List<String> |
getComments() |
@Nullable UUID |
getUniqueCommentId() |
@NotNull Object |
getValue() |
static @NotNull Stream<String> |
streamThroughCommentsIfApplicable(@Nullable Object object,
@Nullable Set<UUID> usedCommentIds)
Returns a stream with the comments on the given object, if it is a
ValueWithComments and its comments
aren't specified to be unique, or if the comments are encountered for the first time. |
static @NotNull Object |
unwrapValue(@NotNull Object object)
Unwraps the value and returns the actual value contained in this wrapper if the object is an instance of
this class.
|
public ValueWithComments(@NotNull
@NotNull Object value,
@NotNull
@NotNull List<String> comments,
@Nullable
@Nullable UUID uniqueCommentId)
The UUID is associated with the comments and should be not null if the comments should only appear once.
Use a random UUID if the comments might appear multiple times, e.g. because they were defined on a type that
a property uses in a collection. If repetition is desired, or if you're creating an object in simple cases where
the comment cannot be repeated, you can use the constructor ValueWithComments(Object, List).
value - the value to wrapcomments - the comments associated with the valueuniqueCommentId - UUID to identify the comment by, if it should not be repeated (null otherwise)@NotNull public @NotNull Object getValue()
@NotNull public @NotNull List<String> getComments()
@Nullable public @Nullable UUID getUniqueCommentId()
@NotNull public static @NotNull Object unwrapValue(@NotNull @NotNull Object object)
object - the object to potentially unwrapValueWithComments if the object is of this type, otherwise the object itself@NotNull public static @NotNull Stream<String> streamThroughCommentsIfApplicable(@Nullable @Nullable Object object, @Nullable @Nullable Set<UUID> usedCommentIds)
ValueWithComments and its comments
aren't specified to be unique, or if the comments are encountered for the first time. An empty stream is returned
if the object is not an instance of this class, or if the comments are defined to be unique and were already
encountered (as determined by the set of used comment IDs).object - the object to get comments from, if applicableusedCommentIds - UUIDs of comments which should not be repeated that have already been includedCopyright © 2016–2023 The AuthMe Team. All rights reserved.