Top Description Inners Fields Constructors Methods
org.eclipse.jgit.lfs.server.internal

public Class LfsGson

extends Object
Class Inheritance
Imports
java.io.Reader, com.google.gson.FieldNamingPolicy, .Gson, .GsonBuilder, .JsonIOException, .JsonSyntaxException

Wrapper for com.google.gson.Gson used by LFS servlets.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
LfsGson.Error

Wrapper class only used for serialization of error messages.

Field Summary

Modifier and TypeField and Description
private static final Gson

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <
a T object.
T
>
T

Returns:

an Object of type T
fromJson
(Reader
reader producing json from which the object is to be deserialized
json
,
Class<T>
specified type to deserialize
classOfT
)

Deserializes the Json read from the specified reader into an object of the specified type.

public static void
toJson(Object
the object for which Json representation is to be created. If this is a String, it is wrapped in an instance of org.eclipse.jgit.lfs.server.internal.LfsGson.Error.
src
,
Appendable
Writer to which the Json representation needs to be written
writer
)

Serializes the specified object into its equivalent Json representation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

gsonback to summary
private static final Gson gson

Constructor Detail

LfsGsonback to summary
public LfsGson()

Method Detail

fromJsonback to summary
public static <T> T fromJson(Reader json, Class<T> classOfT) throws JsonSyntaxException, JsonIOException

Deserializes the Json read from the specified reader into an object of the specified type.

Parameters
<T>
a T object.
json:Reader

reader producing json from which the object is to be deserialized

classOfT:Class<T>

specified type to deserialize

Returns:T

an Object of type T

Exceptions
JsonSyntaxException:
if json is not a valid representation for an object of type
JsonIOException:
if there was a problem reading from the Reader
See Also
Gson#fromJson(Reader, java.lang.reflect.Type)
toJsonback to summary
public static void toJson(Object src, Appendable writer) throws JsonIOException

Serializes the specified object into its equivalent Json representation.

Parameters
src:Object

the object for which Json representation is to be created. If this is a String, it is wrapped in an instance of org.eclipse.jgit.lfs.server.internal.LfsGson.Error.

writer:Appendable

Writer to which the Json representation needs to be written

Exceptions
JsonIOException:
if there was a problem writing to the writer
See Also
Gson#toJson(Object, Appendable)
org.eclipse.jgit.lfs.server.internal back to summary

pack-priv Class LfsGson.Error

extends Object
Class Inheritance
Annotations
@SuppressWarnings:JavaLangClash

Wrapper class only used for serialization of error messages.

Field Summary

Modifier and TypeField and Description
pack-priv String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

messageback to summary
pack-priv String message

Constructor Detail

Errorback to summary
pack-priv Error(String m)