Annotation Interface MarshalledProp
The marshalling-only sibling of @BeanProp.
Where @BeanProp (in name, ro, wo, type, params, elementType,
and factory), this annotation carries the wire-format-specific attributes used by serializers
and parsers: a per-property format string and a bean dictionary for polymorphic types.
Can be used in the following locations:
- Methods/Fields - Bean getters/setters and properties.
@Rest -annotated classes and@RestOp -annotated methods when used with@MarshalledPropApply.
This annotation does not support renaming a property, nor the read-only/write-only, concrete-type,
generic-params, element-type, or bean-factory attributes — those are bean-modeling concerns that live on
@BeanProp instead. To rename a property, use @BeanProp
(e.g.
See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionBig-number wire format override forBigInteger/BigDecimalproperty values.Binary wire format override forproperty values.byte []BitSet wire format override forBitSetproperty values.Boolean wire format override forBoolean/property values.boolean Calendar wire format override.Class wire format override forClassproperty values.Currency wire format override forCurrencyproperty values.Date wire format override.String[]Optional description for the exposed API.Class<?>[]Bean dictionary.Duration wire format override.Enum wire format override forEnumproperty values.Specifies a String format for converting the bean property value to a formatted string.Locale wire format override.Per-property null-coercion policy applied when anullJSON-equivalent value reaches this property during parsing.Period wire format override.Temporal wire format override.Time-zone wire format override.UUID wire format override forUUIDproperty values.String[]Declares the named views this property belongs to.
-
Element Details
-
description
Optional description for the exposed API.- Returns:
- The annotation value.
- Since:
- 9.2.0
- Default:
- {}
-
view
Declares the named views this property belongs to.When an active view is selected (via
MarshallingContext.Builder.activeView(String)or the per-call session override), this property is included only when its declared view set contains the active view name.If this member is empty (the default), the property follows the default-view-inclusion policy: by default an untagged property is included under every active view (matching Jackson's
DEFAULT_VIEW_INCLUSIONbehavior). The policy can be flipped viaMarshallingContext.Builder.disableDefaultViewInclusion().Multiple view names are supported — a property tagged
view={"summary","detail"}is included when either"summary"or"detail"is the active view (union semantics).Example:
public class MyBean {// Included in all views (untagged = default inclusion) public Stringid ;// Included only in the "summary" and "detail" views @MarshalledProp (view={"summary" ,"detail" })public Stringname ;// Included only in the "detail" view @MarshalledProp (view="detail" )public Stringdescription ; }See Also:
- Returns:
- The annotation value.
- Since:
- 10.0.0
- Default:
- {}
-
dictionary
Class<?>[] dictionaryBean dictionary.The list of classes that make up the bean dictionary for this bean property, used during polymorphic marshalling.
See Also:
Marshalled.dictionary()MarshalledConfig.dictionary()MarshalledConfig.dictionary_replace()MarshallingContext.Builder.beanDictionary(Class...)
This annotation can also be used on private fields of a property.
- Returns:
- The annotation value.
- Default:
- {}
-
calendarFormat
Calendar wire format override.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
dateFormat
Date wire format override.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
durationFormat
Duration wire format override.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
format
Specifies a String format for converting the bean property value to a formatted string.Note that this is usually a one-way conversion during serialization.
During parsing, we will attempt to convert the value to the original form by using the
MarshallingSession.convertToType(Object, Class)but there is no guarantee that this will succeed.Example:
@MarshalledProp (format="$%.2f" )public float price ;This annotation can also be used on private fields of a property like so:
Example:
public class MyBean {@MarshalledProp (format="$%.2f" )private float price ;public float getPrice() {return price ; } }- Returns:
- The annotation value.
- Default:
- ""
-
localeFormat
Locale wire format override.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
periodFormat
Period wire format override.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
temporalFormat
Temporal wire format override.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
timeZoneFormat
Time-zone wire format override.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
binaryFormat
Binary wire format override forproperty values.byte []- Returns:
- The annotation value.
- Default:
- NOT_SET
-
enumFormat
Enum wire format override forEnumproperty values.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
uuidFormat
UUID wire format override forUUIDproperty values.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
bitSetFormat
BitSet wire format override forBitSetproperty values.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
bigNumberFormat
Big-number wire format override forBigInteger/BigDecimalproperty values.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
booleanFormat
Boolean wire format override forBoolean/property values.boolean - Returns:
- The annotation value.
- Default:
- NOT_SET
-
floatFormat
- Returns:
- The annotation value.
- Default:
- NOT_SET
-
currencyFormat
Currency wire format override forCurrencyproperty values.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
classFormat
Class wire format override forClassproperty values.- Returns:
- The annotation value.
- Default:
- NOT_SET
-
nulls
Per-property null-coercion policy applied when anullJSON-equivalent value reaches this property during parsing.Juneau's analog of Jackson's
@JsonSetter(nulls=…). When the parser encounters an explicitnull(or an absentOptional) for this property, the configured policy decides whether to:LEAVE(default) — set the property tonull(or, for anOptional-typed property, toOptional.empty()).EMPTY— substitute the type's "empty" value (emptyString/Collection/Map, primitive default for primitives,Optional.empty()forOptional).DEFAULT— substitute the bean-constructed default for the property (i.e. the value the property holds on a fresh no-arg-constructed instance of the bean). When no reference instance can be built, falls back toLEAVE.SKIP— do not call the setter at all, leaving any pre-existing value in place.
For an
Optional-typed property,EMPTY/DEFAULTresolve toOptional.empty()— never a barenullinside anOptional. The same contract applies toOptionalInt,OptionalLong, andOptionalDouble.When this member is
NOT_SET(the default), the context-level default configured onParser.Builder.nulls(Nulls)applies.- Returns:
- The annotation value.
- Since:
- 10.0.0
- Default:
- NOT_SET
-