]>
iEval git - unical.git/blob - LongSerializationPolicy.java
3d9a2da13dbf69ed33a9c01a7bc0cb1f06753452
2 * Copyright (C) 2009 Google Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com
.google
.gson
;
20 * Defines the expected format for a {@code long} or {@code Long} type when its serialized.
24 * @author Inderjeet Singh
27 public enum LongSerializationPolicy
{
29 * This is the "default" serialization policy that will output a {@code long} object as a JSON
30 * number. For example, assume an object has a long field named "f" then the serialized output
35 public JsonElement
serialize(Long value
) {
36 return new JsonPrimitive(value
);
41 * Serializes a long value as a quoted string. For example, assume an object has a long field
42 * named "f" then the serialized output would be:
43 * {@code {"f":"123"}}.
46 public JsonElement
serialize(Long value
) {
47 return new JsonPrimitive(String
.valueOf(value
));
52 * Serialize this {@code value} using this serialization policy.
54 * @param value the long value to be serialized into a {@link JsonElement}
55 * @return the serialized version of {@code value}
57 public abstract JsonElement
serialize(Long value
);
This page took 0.040434 seconds and 3 git commands to generate.