Record Class Message
java.lang.Object
java.lang.Record
io.micronaut.views.fields.messages.Message
- Record Components:
defaultMessage- The default message to use if no code is specified or no localized message found.code- The i18n code which can be used to fetch a localized message.variables- The variables to use resolve message placeholders
- All Implemented Interfaces:
Comparable<Message>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Stringcode()Returns the value of thecoderecord component.int@NonNull @NotBlank StringReturns the value of thedefaultMessagerecord component.booleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.static @NonNull Messageof(@NonNull io.micronaut.core.beans.BeanProperty<?, ?> beanProperty) static @NonNull Messageof(@NonNull jakarta.validation.ConstraintViolation<?> violation) static @NonNull Messagestatic @NonNull Messagestatic @NonNull Messagestatic @NonNull Messagefinal StringtoString()Returns a string representation of this record class.@Nullable Object[]Returns the value of thevariablesrecord component.
-
Constructor Details
-
Message
-
Message
public Message(@NotBlank @NonNull @NotBlank String defaultMessage, @Nullable String code, @Nullable Object[] variables) Creates an instance of aMessagerecord class.- Parameters:
defaultMessage- the value for thedefaultMessagerecord componentcode- the value for thecoderecord componentvariables- the value for thevariablesrecord component
-
-
Method Details
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
hashCode
-
compareTo
- Specified by:
compareToin interfaceComparable<Message>
-
of
-
of
public static @NonNull Message of(@NonNull String defaultMessage, @Nullable String code, @Nullable Object... variables) - Parameters:
defaultMessage- The default message to use if no code is specified or no localized message foundcode- The i18n code which can be used to fetch a localized message.variables- The variables to use resolve message placeholders- Returns:
- A
Messageinstance.
-
of
-
of
-
of
-
of
-
toString
-
defaultMessage
Returns the value of thedefaultMessagerecord component.- Returns:
- the value of the
defaultMessagerecord component
-
code
-
variables
-