]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (C) 2008 Google Inc. | |
3 | * | |
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 | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
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. | |
15 | */ | |
16 | ||
17 | package com.google.gson; | |
18 | ||
19 | import java.lang.reflect.Field; | |
20 | ||
21 | /** | |
22 | * A mechanism for providing custom field naming in Gson. This allows the client code to translate | |
23 | * field names into a particular convention that is not supported as a normal Java field | |
24 | * declaration rules. For example, Java does not support "-" characters in a field name. | |
25 | * | |
26 | * @author Inderjeet Singh | |
27 | * @author Joel Leitch | |
28 | * @since 1.3 | |
29 | */ | |
30 | public interface FieldNamingStrategy { | |
31 | ||
32 | /** | |
33 | * Translates the field name into its JSON field name representation. | |
34 | * | |
35 | * @param f the field object that we are translating | |
36 | * @return the translated field name. | |
37 | * @since 1.3 | |
38 | */ | |
39 | public String translateName(Field f); | |
40 | } |