Package org.eclipse.ditto.json
Class JsonMissingFieldException.Builder
java.lang.Object
org.eclipse.ditto.json.AbstractJsonExceptionBuilder<JsonMissingFieldException>
org.eclipse.ditto.json.JsonMissingFieldException.Builder
- All Implemented Interfaces:
JsonExceptionBuilder<JsonMissingFieldException>
- Enclosing class:
- JsonMissingFieldException
@NotThreadSafe
public static final class JsonMissingFieldException.Builder
extends AbstractJsonExceptionBuilder<JsonMissingFieldException>
A mutable builder for a
JsonMissingFieldException
.-
Method Summary
Modifier and TypeMethodDescriptionprotected JsonMissingFieldException
This method must be implemented by subclasses.fieldName
(CharSequence missingFieldName) Sets a message which points to the name of the missing field.fieldName
(CharSequence missingFieldNameRoot, CharSequence... missingFieldNameChildren) Sets a message which points to the name of the missing field within a hierarchy.Methods inherited from class org.eclipse.ditto.json.AbstractJsonExceptionBuilder
build, cause, cause, description, description, href, href, message, message
-
Method Details
-
fieldName
Sets a message which points to the name of the missing field. Thus if this method is called,AbstractJsonExceptionBuilder.message
should not be called.- Parameters:
missingFieldName
- the name of the missing field.- Returns:
- this builder to allow method chaining.
-
fieldName
public JsonMissingFieldException.Builder fieldName(CharSequence missingFieldNameRoot, CharSequence... missingFieldNameChildren) Sets a message which points to the name of the missing field within a hierarchy.Given the following valid JSON object:
{ "attributes": { "localSeason": { "season": "autumn", "location": { "country": "Germany", "state": "Baden-Wuerttemberg", "place": "Leimerstetten" } } } }
If, for example, the field
state
is missing the call to this method would befieldName("attributes", "localSeason", "location", "state")
.- Parameters:
missingFieldNameRoot
- the root of the hierarchy.missingFieldNameChildren
- all children, grand children etc. ofmissingFieldNameRoot
.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException
- if any argument isnull
.- See Also:
-
doBuild
protected JsonMissingFieldException doBuild(String errorCode, @Nullable String message, @Nullable String description, @Nullable Throwable cause, @Nullable URI href) Description copied from class:AbstractJsonExceptionBuilder
This method must be implemented by subclasses. It is responsible for actually building the exception object. Therefore it receives the data which was provided during the building process.- Specified by:
doBuild
in classAbstractJsonExceptionBuilder<JsonMissingFieldException>
- Parameters:
errorCode
- the error code.message
- the detail message ornull
.description
- the description ornull
.cause
- the cause ornull
.href
- the link to further information ornull
.- Returns:
- a new exception of the target type.
-