Enum DittoHeaderDefinition
- java.lang.Object
-
- java.lang.Enum<DittoHeaderDefinition>
-
- org.eclipse.ditto.model.base.headers.DittoHeaderDefinition
-
- All Implemented Interfaces:
Serializable
,Comparable<DittoHeaderDefinition>
,HeaderDefinition
public enum DittoHeaderDefinition extends Enum<DittoHeaderDefinition> implements HeaderDefinition
Enumeration of definitions of well known Ditto Headers including their key and Java type. Note: All header keys must be lower-case;
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AUTHORIZATION_CONTEXT
Header definition for the authorization context value.CHANNEL
Header definition for channel value meaning distinguishing between live/twin.CONTENT_TYPE
Header definition for a signal's content-type.CORRELATION_ID
Header definition for correlation Id value.DRY_RUN
Header definition for dry run value.ENTITY_ID
Header definition for the entity id related to the command/event/response/error.ETAG
Header definition for "ETag".IF_MATCH
Header definition for "If-Match".IF_NONE_MATCH
Header definition for "If-None-Match".INBOUND_PAYLOAD_MAPPER
Header definition for "ditto-inbound-payload-mapper".LOCATION
Header definition for the response header defining the HTTP "Location" where a new resource was created.ORIGIN
Header definition for origin value that is set to the id of the originating session.ORIGINATOR
Header definition for the authorization subject that caused an event.READ_REVOKED_SUBJECTS
Header definition for subjects with revoked READ subjects.READ_SUBJECTS
Header definition for read subjects value.REPLY_TARGET
Header definition for the internal header "ditto-reply-target".REPLY_TO
Header definition for the reply to address.REQUESTED_ACKS
Header definition for defining which acknowledgements ("ack") are requested for a command processed by Ditto.RESPONSE_REQUIRED
Header definition for response required value.SCHEMA_VERSION
Header definition for schema version value.TIMEOUT
Header definition for the timeout of a command or message.WWW_AUTHENTICATE
Header definition for the response header defining which authentication method that should be used to gain access to a resource
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Optional<HeaderDefinition>
forKey(CharSequence key)
Finds an appropriateDittoHeaderKey
for the specified key.Class
getJavaType()
Returns the Java type of the header value which is associated with this definition's key.String
getKey()
Returns the key used as key for header map.Class
getSerializationType()
Returns the type to which this header value should be serialized.boolean
shouldReadFromExternalHeaders()
Returns whether Ditto reads this header from headers sent by externals.boolean
shouldWriteToExternalHeaders()
Returns whether Ditto publishes this header to externals.String
toString()
Same asHeaderDefinition.getKey()
.void
validateValue(CharSequence value)
Checks if the specified CharSequence is a valid representation of the Java type of this definition.static DittoHeaderDefinition
valueOf(String name)
Returns the enum constant of this type with the specified name.static DittoHeaderDefinition[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
AUTHORIZATION_CONTEXT
public static final DittoHeaderDefinition AUTHORIZATION_CONTEXT
Header definition for the authorization context value.Key:
"ditto-auth-context"
, Java type:JsonObject
.
-
CORRELATION_ID
public static final DittoHeaderDefinition CORRELATION_ID
Header definition for correlation Id value.Key:
"correlation-id"
, Java type:String
.
-
SCHEMA_VERSION
public static final DittoHeaderDefinition SCHEMA_VERSION
Header definition for schema version value.Key:
"version"
, Java type:int
.
-
RESPONSE_REQUIRED
public static final DittoHeaderDefinition RESPONSE_REQUIRED
Header definition for response required value.Key:
"response-required"
, Java type:boolean
.
-
DRY_RUN
public static final DittoHeaderDefinition DRY_RUN
Header definition for dry run value.Key:
"ditto-dry-run"
, Java type:boolean
.
-
READ_SUBJECTS
public static final DittoHeaderDefinition READ_SUBJECTS
Header definition for read subjects value.Key:
"read-subjects"
, Java type:JsonArray
.
-
READ_REVOKED_SUBJECTS
public static final DittoHeaderDefinition READ_REVOKED_SUBJECTS
Header definition for subjects with revoked READ subjects.Key:
"read-revoked-subjects"
, Java type:JsonArray
.- Since:
- 1.1.0
-
CONTENT_TYPE
public static final DittoHeaderDefinition CONTENT_TYPE
Header definition for a signal's content-type.Key:
"content-type"
, Java type:String
.
-
REPLY_TO
public static final DittoHeaderDefinition REPLY_TO
Header definition for the reply to address. MUST be lower-case. "reply-to" is a standard internet message header (RFC-5322).Key:
"reply-to"
, Java type: String.- Since:
- 1.1.0
-
CHANNEL
public static final DittoHeaderDefinition CHANNEL
Header definition for channel value meaning distinguishing between live/twin.Key:
"ditto-channel"
, Java type:String
.
-
ORIGIN
public static final DittoHeaderDefinition ORIGIN
Header definition for origin value that is set to the id of the originating session.Key:
"ditto-origin"
, Java type:String
.
-
ETAG
public static final DittoHeaderDefinition ETAG
Header definition for "ETag".Key:
"ETag"
, Java type:String
.
-
IF_MATCH
public static final DittoHeaderDefinition IF_MATCH
Header definition for "If-Match".Key:
"If-Match"
, Java type:String
.
-
IF_NONE_MATCH
public static final DittoHeaderDefinition IF_NONE_MATCH
Header definition for "If-None-Match".Key:
"If-None-Match"
, Java type:String
.
-
REPLY_TARGET
public static final DittoHeaderDefinition REPLY_TARGET
Header definition for the internal header "ditto-reply-target". This header is evaluated for responses to be published.Key:
"ditto-reply-target"
, Java type:Integer
.
-
INBOUND_PAYLOAD_MAPPER
public static final DittoHeaderDefinition INBOUND_PAYLOAD_MAPPER
Header definition for "ditto-inbound-payload-mapper".Key:
"ditto-inbound-payload-mapper"
, Java type:String
.
-
ORIGINATOR
public static final DittoHeaderDefinition ORIGINATOR
Header definition for the authorization subject that caused an event. External header of the same name is always discarded.Key:
"ditto-originator"
, Java type:String
.
-
REQUESTED_ACKS
public static final DittoHeaderDefinition REQUESTED_ACKS
Header definition for defining which acknowledgements ("ack") are requested for a command processed by Ditto.Key:
"requested-acks"
, Java type:JsonArray
.- Since:
- 1.1.0
-
TIMEOUT
public static final DittoHeaderDefinition TIMEOUT
Header definition for the timeout of a command or message.Key:
"timeout"
, Java type:String
.- Since:
- 1.1.0
-
ENTITY_ID
public static final DittoHeaderDefinition ENTITY_ID
Header definition for the entity id related to the command/event/response/error.Key:
"ditto-entity-id"
, Java type:String
.- Since:
- 1.1.0
-
WWW_AUTHENTICATE
public static final DittoHeaderDefinition WWW_AUTHENTICATE
Header definition for the response header defining which authentication method that should be used to gain access to a resourceKey:
"www-authenticate"
, Java type:String
.- Since:
- 1.1.0
-
LOCATION
public static final DittoHeaderDefinition LOCATION
Header definition for the response header defining the HTTP "Location" where a new resource was created.Key:
"location"
, Java type:String
.- Since:
- 1.1.0
-
-
Method Detail
-
values
public static DittoHeaderDefinition[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DittoHeaderDefinition c : DittoHeaderDefinition.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DittoHeaderDefinition valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
forKey
public static Optional<HeaderDefinition> forKey(@Nullable CharSequence key)
Finds an appropriateDittoHeaderKey
for the specified key.- Parameters:
key
- the key to look up.- Returns:
- the DittoHeaderKey or an empty Optional.
-
getKey
public String getKey()
Description copied from interface:HeaderDefinition
Returns the key used as key for header map.- Specified by:
getKey
in interfaceHeaderDefinition
- Returns:
- the key.
-
getJavaType
public Class getJavaType()
Description copied from interface:HeaderDefinition
Returns the Java type of the header value which is associated with this definition's key.- Specified by:
getJavaType
in interfaceHeaderDefinition
- Returns:
- the Java type.
- See Also:
HeaderDefinition.getKey()
-
getSerializationType
public Class getSerializationType()
Description copied from interface:HeaderDefinition
Returns the type to which this header value should be serialized.- Specified by:
getSerializationType
in interfaceHeaderDefinition
- Returns:
- the serialization type
-
shouldReadFromExternalHeaders
public boolean shouldReadFromExternalHeaders()
Description copied from interface:HeaderDefinition
Returns whether Ditto reads this header from headers sent by externals.- Specified by:
shouldReadFromExternalHeaders
in interfaceHeaderDefinition
- Returns:
- whether externals are allowed to set this header.
-
shouldWriteToExternalHeaders
public boolean shouldWriteToExternalHeaders()
Description copied from interface:HeaderDefinition
Returns whether Ditto publishes this header to externals.- Specified by:
shouldWriteToExternalHeaders
in interfaceHeaderDefinition
- Returns:
- whether externals are allowed to see this header.
-
validateValue
public void validateValue(@Nullable CharSequence value)
Description copied from interface:HeaderDefinition
Checks if the specified CharSequence is a valid representation of the Java type of this definition.For example, if the Java type of this Definition was
int.class
then the value"foo"
would be invalid whereas the value42
would be recognised to be valid.- Specified by:
validateValue
in interfaceHeaderDefinition
- Parameters:
value
- the value to be validated.- See Also:
HeaderDefinition.getJavaType()
-
toString
public String toString()
Description copied from interface:HeaderDefinition
Same asHeaderDefinition.getKey()
.- Specified by:
toString
in interfaceHeaderDefinition
- Overrides:
toString
in classEnum<DittoHeaderDefinition>
- Returns:
- the key of this enum constant.
-
-