Serialization Classe

  • java.lang.Object
    • com.microsoft.bot.schema.Serialization

public final class Serialization

Helpers de sérialisation.

Résumé de la méthode

Modificateur et type Méthode et description
static java.util.concurrent.CompletableFuture<R> <R>futureGetAs(Object obj, Class<R> classType)

Désérialise un objet à un type comme un avenir pour faciliter le chaînage CompletableFuture.

static T <T>convert(Object source, Class<T> toClass)

Convertit un objet d’entrée en un autre type.

static T <T>getAs(Object obj, Class<T> classType)

Désérialisez une valeur.

static T <T>safeGetAs(Object obj, Class<T> classType)

Désérialisez une valeur.

static T <T>treeToValue(JsonNode src, Class<T> cls)
static com.fasterxml.jackson.databind.JsonNode asNode(boolean b)
static com.fasterxml.jackson.databind.JsonNode asNode(byte b)
static com.fasterxml.jackson.databind.JsonNode asNode(double d)
static com.fasterxml.jackson.databind.JsonNode asNode(float f)
static com.fasterxml.jackson.databind.JsonNode asNode(int i)
static com.fasterxml.jackson.databind.JsonNode asNode(String s)
static com.fasterxml.jackson.databind.JsonNode asNode(long l)
static com.fasterxml.jackson.databind.JsonNode asNode(short s)
static java.lang.Object clone(Object obj)
static com.fasterxml.jackson.databind.node.ArrayNode createArrayNode()

Crée un nœudarray.

static com.fasterxml.jackson.databind.node.ObjectNode createObjectNode()

Crée un nœud d’objet.

static com.fasterxml.jackson.databind.JsonNode jsonToTree(String json)

Analyse un document JSON.

static com.fasterxml.jackson.databind.JsonNode objectToTree(Object obj)

Convertissez l’objet en nœudJson.

static java.lang.String toString(Object source)

Convertissez un objet en chaîne JSON.

static java.lang.String toStringSilent(Object source)

Convertissez un objet en chaîne JSON.

Méthodes héritées de java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Détails de la méthode

<R>futureGetAs

public static CompletableFuture futureGetAs(Object obj, Class classType)

Désérialise un objet à un type comme un avenir pour faciliter le chaînage CompletableFuture.

Paramètres:

obj - Objet à désérialiser.
classType - Informations de classe à convertir.

Retours:

CompletableFuture contenant la valeur ou l’exception pour une erreur.

<T>convert

public static T convert(Object source, Class toClass)

Convertit un objet d’entrée en un autre type.

Paramètres:

source - Objet à convertir.
toClass - Classe à convertir.

Retours:

Objet converti ou null.

<T>getAs

public static T getAs(Object obj, Class classType)

Désérialisez une valeur.

Paramètres:

obj - Objet à désérialiser.
classType - Type de classe à convertir.

Retours:

Un POJO désérialisé ou null pour une erreur.

<T>safeGetAs

public static T safeGetAs(Object obj, Class classType)

Désérialisez une valeur.

Paramètres:

obj - Objet à désérialiser.
classType - Type de classe à convertir.

Retours:

PoJO désérialisé ou null.

Exception:

com.fasterxml.jackson.core.JsonProcessingException - Exception de traitement JSON.

<T>treeToValue

public static T treeToValue(JsonNode src, Class cls)

Paramètres:

src - The source JsonNode
cls - Classe à mapper

Retours:

résultat du mappage

asNode

public static JsonNode asNode(boolean b)

Paramètres:

b - Boolean à convertir en JsonNode

Retours:

JsonNode

asNode

public static JsonNode asNode(byte b)

Paramètres:

b - Octet à convertir en JsonNode

Retours:

JsonNode

asNode

public static JsonNode asNode(double d)

Paramètres:

d - Double à convertir en JsonNode

Retours:

JsonNode

asNode

public static JsonNode asNode(float f)

Paramètres:

f - Float à convertir en JsonNode

Retours:

JsonNode

asNode

public static JsonNode asNode(int i)

Paramètres:

i - Int à convertir en JsonNode

Retours:

JsonNode

asNode

public static JsonNode asNode(String s)

Paramètres:

s - Chaîne à convertir en JsonNode

Retours:

JsonNode

asNode

public static JsonNode asNode(long l)

Paramètres:

l - Long à convertir en JsonNode

Retours:

JsonNode

asNode

public static JsonNode asNode(short s)

Paramètres:

s - Court à convertir en JsonNode

Retours:

JsonNode

clone

public static Object clone(Object obj)

Paramètres:

obj - Objet à cloner

Retours:

Objet l’objet cloné

createArrayNode

public static ArrayNode createArrayNode()

Crée un ArrayNode.

Retours:

ArrayNode.

createObjectNode

public static ObjectNode createObjectNode()

Crée un ObjectNode.

Retours:

ObjectNode.

jsonToTree

public static JsonNode jsonToTree(String json)

Analyse un document JSON.

Paramètres:

json - JSON à analyser.

Retours:

JsonNode contenant l’arborescence des nœuds.

Exception:

java.io.IOException - Erreur d’analyse json.

objectToTree

public static JsonNode objectToTree(Object obj)

Convertissez l’objet en JsonNode.

Paramètres:

obj - Objet à convertir.

Retours:

JsonNode pour l’arborescence d’objets.

toString

public static String toString(Object source)

Convertissez un objet en chaîne JSON.

Paramètres:

source - Objet à convertir.

Retours:

Valeur de chaîne JSON.

Exception:

com.fasterxml.jackson.core.JsonProcessingException - Erreur lors de la conversion en JSON

toStringSilent

public static String toStringSilent(Object source)

Convertissez un objet en chaîne JSON.

Paramètres:

source - Objet à convertir.

Retours:

Valeur de chaîne JSON.

S’applique à