100 строки
15 KiB
YAML
100 строки
15 KiB
YAML
### YamlMime:JavaType
|
|
uid: "com.azure.json.JsonWriteContext"
|
|
fullName: "com.azure.json.JsonWriteContext"
|
|
name: "JsonWriteContext"
|
|
nameWithType: "JsonWriteContext"
|
|
summary: "Context of JSON handling."
|
|
inheritances:
|
|
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
|
|
inheritedClassMethods:
|
|
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
|
|
methodsRef:
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
|
|
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
|
|
syntax: "public final class **JsonWriteContext**"
|
|
fields:
|
|
- uid: "com.azure.json.JsonWriteContext.COMPLETED"
|
|
fullName: "com.azure.json.JsonWriteContext.COMPLETED"
|
|
name: "COMPLETED"
|
|
nameWithType: "JsonWriteContext.COMPLETED"
|
|
summary: "Final writing context."
|
|
modifiers:
|
|
- "static"
|
|
- "final"
|
|
field:
|
|
type: "<xref href=\"com.azure.json.JsonWriteContext?alt=com.azure.json.JsonWriteContext&text=JsonWriteContext\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public static final JsonWriteContext COMPLETED"
|
|
desc: "Final writing context."
|
|
- uid: "com.azure.json.JsonWriteContext.ROOT"
|
|
fullName: "com.azure.json.JsonWriteContext.ROOT"
|
|
name: "ROOT"
|
|
nameWithType: "JsonWriteContext.ROOT"
|
|
summary: "Initial writing context."
|
|
modifiers:
|
|
- "static"
|
|
- "final"
|
|
field:
|
|
type: "<xref href=\"com.azure.json.JsonWriteContext?alt=com.azure.json.JsonWriteContext&text=JsonWriteContext\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public static final JsonWriteContext ROOT"
|
|
desc: "Initial writing context."
|
|
methods:
|
|
- uid: "com.azure.json.JsonWriteContext.getParent()"
|
|
fullName: "com.azure.json.JsonWriteContext.getParent()"
|
|
name: "getParent()"
|
|
nameWithType: "JsonWriteContext.getParent()"
|
|
summary: "Gets the parent <xref uid=\"com.azure.json.JsonWriteContext\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext\"></xref>."
|
|
syntax: "public JsonWriteContext getParent()"
|
|
desc: "Gets the parent <xref uid=\"com.azure.json.JsonWriteContext\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext\"></xref>.\n\n<xref uid=\"com.azure.json.JsonWriteContext.ROOT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext#ROOT\"></xref> and <xref uid=\"com.azure.json.JsonWriteContext.COMPLETED\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext#COMPLETED\"></xref> are terminal writing contexts and don't have parent contexts. These are the only writing contexts that will return null."
|
|
returns:
|
|
description: "The parent writing context."
|
|
type: "<xref href=\"com.azure.json.JsonWriteContext?alt=com.azure.json.JsonWriteContext&text=JsonWriteContext\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.json.JsonWriteContext.getWriteState()"
|
|
fullName: "com.azure.json.JsonWriteContext.getWriteState()"
|
|
name: "getWriteState()"
|
|
nameWithType: "JsonWriteContext.getWriteState()"
|
|
summary: "Gets the <xref uid=\"com.azure.json.JsonWriteState\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState\"></xref> associated to the writing context."
|
|
syntax: "public JsonWriteState getWriteState()"
|
|
desc: "Gets the <xref uid=\"com.azure.json.JsonWriteState\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState\"></xref> associated to the writing context."
|
|
returns:
|
|
description: "The <xref uid=\"com.azure.json.JsonWriteState\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState\"></xref> associated to the writing context."
|
|
type: "<xref href=\"com.azure.json.JsonWriteState?alt=com.azure.json.JsonWriteState&text=JsonWriteState\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.json.JsonWriteContext.updateContext(com.azure.json.JsonToken)"
|
|
fullName: "com.azure.json.JsonWriteContext.updateContext(JsonToken token)"
|
|
name: "updateContext(JsonToken token)"
|
|
nameWithType: "JsonWriteContext.updateContext(JsonToken token)"
|
|
summary: "Updates the context based on the <xref uid=\"com.azure.json.JsonToken\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken\"></xref> that was written."
|
|
parameters:
|
|
- description: "The <xref uid=\"com.azure.json.JsonToken\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken\"></xref> triggering the update."
|
|
name: "token"
|
|
type: "<xref href=\"com.azure.json.JsonToken?alt=com.azure.json.JsonToken&text=JsonToken\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public JsonWriteContext updateContext(JsonToken token)"
|
|
desc: "Updates the context based on the <xref uid=\"com.azure.json.JsonToken\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken\"></xref> that was written.\n\nTokens <xref uid=\"com.azure.json.JsonToken.BOOLEAN\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#BOOLEAN\"></xref>, <xref uid=\"com.azure.json.JsonToken.NULL\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#NULL\"></xref>, <xref uid=\"com.azure.json.JsonToken.NUMBER\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#NUMBER\"></xref>, and <xref uid=\"com.azure.json.JsonToken.STRING\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#STRING\"></xref> can mutate the current state in three different ways. If the current context is <xref uid=\"com.azure.json.JsonWriteContext.ROOT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext#ROOT\"></xref> then <xref uid=\"com.azure.json.JsonWriteContext.COMPLETED\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext#COMPLETED\"></xref> is the updated context as the JSON stream has completed writing. If the current context is <xref uid=\"com.azure.json.JsonWriteState.ARRAY\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState#ARRAY\"></xref> then this context is returned without mutation as writing an element to an array doesn't complete the array. Otherwise, the parent context is returned as the only other legal context is <xref uid=\"com.azure.json.JsonWriteState.FIELD\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState#FIELD\"></xref> and writing a value completes the field.\n\nTokens <xref uid=\"com.azure.json.JsonToken.END_OBJECT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#END_OBJECT\"></xref> and <xref uid=\"com.azure.json.JsonToken.END_ARRAY\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#END_ARRAY\"></xref> complete the current context and prepare set the parent context for return. If the parent context is <xref uid=\"com.azure.json.JsonWriteContext.ROOT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext#ROOT\"></xref> then <xref uid=\"com.azure.json.JsonWriteContext.COMPLETED\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext#COMPLETED\"></xref> is the updated context as the JSON stream has completed writing. Otherwise, if the parent context is <xref uid=\"com.azure.json.JsonWriteState.FIELD\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState#FIELD\"></xref> that will be completed as well as the field has completed writing.\n\nTokens <xref uid=\"com.azure.json.JsonToken.START_OBJECT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#START_OBJECT\"></xref>, <xref uid=\"com.azure.json.JsonToken.START_ARRAY\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#START_ARRAY\"></xref>, and <xref uid=\"com.azure.json.JsonToken.FIELD_NAME\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#FIELD_NAME\"></xref> create a child context where the current context becomes the parent context.\n\nField and value APIs in <xref uid=\"com.azure.json.JsonWriter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriter\"></xref>, such as <xref uid=\"com.azure.json.JsonWriter.writeStringField(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriter#writeStringField(String, String)\"></xref>, are self-closing operations that will maintain the current context."
|
|
returns:
|
|
description: "The updated writing context."
|
|
type: "<xref href=\"com.azure.json.JsonWriteContext?alt=com.azure.json.JsonWriteContext&text=JsonWriteContext\" data-throw-if-not-resolved=\"False\" />"
|
|
- uid: "com.azure.json.JsonWriteContext.validateToken(com.azure.json.JsonToken)"
|
|
fullName: "com.azure.json.JsonWriteContext.validateToken(JsonToken token)"
|
|
name: "validateToken(JsonToken token)"
|
|
nameWithType: "JsonWriteContext.validateToken(JsonToken token)"
|
|
summary: "Determines whether the <xref uid=\"com.azure.json.JsonToken\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken\"></xref> is allowed to be written based on the <xref uid=\"com.azure.json.JsonWriteState\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState\"></xref>."
|
|
parameters:
|
|
- description: "The <xref uid=\"com.azure.json.JsonToken\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken\"></xref> that is being validated for being writable in the current state."
|
|
name: "token"
|
|
type: "<xref href=\"com.azure.json.JsonToken?alt=com.azure.json.JsonToken&text=JsonToken\" data-throw-if-not-resolved=\"False\" />"
|
|
syntax: "public void validateToken(JsonToken token)"
|
|
desc: "Determines whether the <xref uid=\"com.azure.json.JsonToken\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken\"></xref> is allowed to be written based on the <xref uid=\"com.azure.json.JsonWriteState\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState\"></xref>.\n\nThe following is the allowed <xref uid=\"com.azure.json.JsonToken\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonTokens\"></xref> based on the <xref uid=\"com.azure.json.JsonWriteState\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState\"></xref>.\n\n * <xref uid=\"com.azure.json.JsonWriteState.ROOT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState#ROOT\"></xref> \\- <xref uid=\"com.azure.json.JsonToken.START_OBJECT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#START_OBJECT\"></xref>, <xref uid=\"com.azure.json.JsonToken.START_ARRAY\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#START_ARRAY\"></xref>, <xref uid=\"com.azure.json.JsonToken.BOOLEAN\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#BOOLEAN\"></xref>, <xref uid=\"com.azure.json.JsonToken.NULL\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#NULL\"></xref>, <xref uid=\"com.azure.json.JsonToken.NUMBER\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#NUMBER\"></xref>, <xref uid=\"com.azure.json.JsonToken.STRING\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#STRING\"></xref>\n * <xref uid=\"com.azure.json.JsonWriteState.OBJECT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState#OBJECT\"></xref> \\- <xref uid=\"com.azure.json.JsonToken.END_OBJECT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#END_OBJECT\"></xref>, <xref uid=\"com.azure.json.JsonToken.FIELD_NAME\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#FIELD_NAME\"></xref>\n * <xref uid=\"com.azure.json.JsonWriteState.ARRAY\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState#ARRAY\"></xref> \\- <xref uid=\"com.azure.json.JsonToken.START_OBJECT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#START_OBJECT\"></xref>, <xref uid=\"com.azure.json.JsonToken.START_ARRAY\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#START_ARRAY\"></xref>, <xref uid=\"com.azure.json.JsonToken.END_ARRAY\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#END_ARRAY\"></xref>, <xref uid=\"com.azure.json.JsonToken.BOOLEAN\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#BOOLEAN\"></xref>, <xref uid=\"com.azure.json.JsonToken.NULL\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#NULL\"></xref>, <xref uid=\"com.azure.json.JsonToken.NUMBER\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#NUMBER\"></xref>, <xref uid=\"com.azure.json.JsonToken.STRING\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#STRING\"></xref>\n * <xref uid=\"com.azure.json.JsonWriteState.FIELD\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState#FIELD\"></xref> \\- <xref uid=\"com.azure.json.JsonToken.START_OBJECT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#START_OBJECT\"></xref>, <xref uid=\"com.azure.json.JsonToken.START_ARRAY\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#START_ARRAY\"></xref>, <xref uid=\"com.azure.json.JsonToken.BOOLEAN\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#BOOLEAN\"></xref>, <xref uid=\"com.azure.json.JsonToken.NULL\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#NULL\"></xref>, <xref uid=\"com.azure.json.JsonToken.NUMBER\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#NUMBER\"></xref>, <xref uid=\"com.azure.json.JsonToken.STRING\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#STRING\"></xref>\n * <xref uid=\"com.azure.json.JsonWriteState.COMPLETED\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState#COMPLETED\"></xref> \\- none\n\nAny token that isn't allowed based on the context will result in an <xref uid=\"\" data-throw-if-not-resolved=\"false\" data-raw-source=\"IllegalStateException\"></xref>.\n\nField and value APIs in <xref uid=\"com.azure.json.JsonWriter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriter\"></xref>, such as <xref uid=\"com.azure.json.JsonWriter.writeStringField(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriter#writeStringField(String, String)\"></xref>, will validate with <xref uid=\"com.azure.json.JsonToken.FIELD_NAME\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#FIELD_NAME\"></xref> as they're self-closing operations."
|
|
type: "class"
|
|
desc: "Context of JSON handling.\n\nWriting context is immutable, any calls to <xref uid=\"com.azure.json.JsonWriteContext.updateContext(com.azure.json.JsonToken)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#updateContext(JsonToken)\"></xref> will result in either a previous context being returned or the creation of a new context."
|
|
metadata: {}
|
|
package: "com.azure.json"
|
|
artifact: com.azure:azure-json:1.3.0
|