Package org.apache.juneau.marshall
Class ContextSession.Builder<SELF extends ContextSession.Builder<SELF>>
java.lang.Object
org.apache.juneau.marshall.ContextSession.Builder<SELF>
- Direct Known Subclasses:
MarshallingSession.Builder,RestOpSession.Builder,RestSession.Builder
- Enclosing class:
- ContextSession
public abstract static class ContextSession.Builder<SELF extends ContextSession.Builder<SELF>>
extends Object
Builder class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> SELFApplies a consumer to this builder if it's the specified type.abstract ContextSessionbuild()Build the object.protected static <T> TConvenience method for converting values usingBasicConverter.Debug mode.properties(Map<String, Object> value) Session properties.Adds a property to this session.protected final SELFself()Returns this object cast to the self (CRTP) type.Create an unmodifiable session.
-
Constructor Details
-
Builder
Constructor.- Parameters:
ctx- The context creating this session.
Cannot benull .
-
-
Method Details
-
self
Returns this object cast to the self (CRTP) type.- Returns:
- This object.
-
cvt
Convenience method for converting values usingBasicConverter.- Type Parameters:
T- The target type.- Parameters:
value- The value to convert.
Can benull (returnsnull ).type- The target class.- Returns:
- The converted value, or
null if the input value wasnull .
-
apply
Applies a consumer to this builder if it's the specified type.- Type Parameters:
T- The expected type.- Parameters:
type- The expected type.
Cannot benull .apply- The consumer to apply.
Cannot benull .- Returns:
- This object.
-
build
Build the object.- Returns:
- The built object.
-
debug
Debug mode.Enables the following additional information during parsing:
- When bean setters throws exceptions, the exception includes the object stack information in order to determine how that method was invoked.
If not specified, defaults to
Context.Builder.debug().See Also:
- Parameters:
value- The new value for this property.
Ifnull , defaults toContext.isDebug().- Returns:
- This object.
-
properties
Session properties.Session properties are generic key-value pairs that can be passed through the session and made available to any customized serializers/parsers or swaps.
- Parameters:
value- The new value for this property.
Cannot benull .- Returns:
- This object.
-
property
Adds a property to this session.If the key matches a known session property (e.g.
"debug" or"ContextSession.debug" ), the value is converted viaBasicConverterand routed to the corresponding typed setter. Unknown keys are stored in the raw session properties map.- Parameters:
key- The property key.
Cannot benull .value- The property value.
Can benull (resets typed properties to their default; removes raw properties).- Returns:
- This object.
-
unmodifiable
Create an unmodifiable session.The created ContextSession object will be unmodifiable which makes it suitable for caching and reuse.
- Returns:
- This object.
-