EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.gogrid.functions.internal]

COVERAGE SUMMARY FOR SOURCE FILE [CustomDeserializers.java]

nameclass, %method, %block, %line, %
CustomDeserializers.java91%  (10/11)95%  (20/21)98%  (120/123)95%  (29.5/31)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CustomDeserializers0%   (0/1)0%   (0/1)0%   (0/3)0%   (0/2)
CustomDeserializers (): void 0%   (0/1)0%   (0/3)0%   (0/2)
     
class CustomDeserializers$IpStateAdapter100% (1/1)100% (2/2)100% (12/12)100% (3/3)
CustomDeserializers$IpStateAdapter (): void 100% (1/1)100% (3/3)100% (1/1)
deserialize (JsonElement, Type, JsonDeserializationContext): IpState 100% (1/1)100% (9/9)100% (2/2)
     
class CustomDeserializers$JobStateAdapter100% (1/1)100% (2/2)100% (12/12)100% (3/3)
CustomDeserializers$JobStateAdapter (): void 100% (1/1)100% (3/3)100% (1/1)
deserialize (JsonElement, Type, JsonDeserializationContext): JobState 100% (1/1)100% (9/9)100% (2/2)
     
class CustomDeserializers$LoadBalancerOsAdapter100% (1/1)100% (2/2)100% (12/12)100% (3/3)
CustomDeserializers$LoadBalancerOsAdapter (): void 100% (1/1)100% (3/3)100% (1/1)
deserialize (JsonElement, Type, JsonDeserializationContext): LoadBalancerOs 100% (1/1)100% (9/9)100% (2/2)
     
class CustomDeserializers$LoadBalancerPersistenceTypeAdapter100% (1/1)100% (2/2)100% (12/12)100% (3/3)
CustomDeserializers$LoadBalancerPersistenceTypeAdapter (): void 100% (1/1)100% (3/3)100% (1/1)
deserialize (JsonElement, Type, JsonDeserializationContext): LoadBalancerPers... 100% (1/1)100% (9/9)100% (2/2)
     
class CustomDeserializers$LoadBalancerStateAdapter100% (1/1)100% (2/2)100% (12/12)100% (3/3)
CustomDeserializers$LoadBalancerStateAdapter (): void 100% (1/1)100% (3/3)100% (1/1)
deserialize (JsonElement, Type, JsonDeserializationContext): LoadBalancerState 100% (1/1)100% (9/9)100% (2/2)
     
class CustomDeserializers$LoadBalancerTypeAdapter100% (1/1)100% (2/2)100% (12/12)100% (3/3)
CustomDeserializers$LoadBalancerTypeAdapter (): void 100% (1/1)100% (3/3)100% (1/1)
deserialize (JsonElement, Type, JsonDeserializationContext): LoadBalancerType 100% (1/1)100% (9/9)100% (2/2)
     
class CustomDeserializers$ObjectTypeAdapter100% (1/1)100% (2/2)100% (12/12)100% (3/3)
CustomDeserializers$ObjectTypeAdapter (): void 100% (1/1)100% (3/3)100% (1/1)
deserialize (JsonElement, Type, JsonDeserializationContext): ObjectType 100% (1/1)100% (9/9)100% (2/2)
     
class CustomDeserializers$ServerImageStateAdapter100% (1/1)100% (2/2)100% (12/12)100% (3/3)
CustomDeserializers$ServerImageStateAdapter (): void 100% (1/1)100% (3/3)100% (1/1)
deserialize (JsonElement, Type, JsonDeserializationContext): ServerImageState 100% (1/1)100% (9/9)100% (2/2)
     
class CustomDeserializers$ServerImageTypeAdapter100% (1/1)100% (2/2)100% (12/12)100% (3/3)
CustomDeserializers$ServerImageTypeAdapter (): void 100% (1/1)100% (3/3)100% (1/1)
deserialize (JsonElement, Type, JsonDeserializationContext): ServerImageType 100% (1/1)100% (9/9)100% (2/2)
     
class CustomDeserializers$ServerStateAdapter100% (1/1)100% (2/2)100% (12/12)100% (3/3)
CustomDeserializers$ServerStateAdapter (): void 100% (1/1)100% (3/3)100% (1/1)
deserialize (JsonElement, Type, JsonDeserializationContext): ServerState 100% (1/1)100% (9/9)100% (2/2)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *   http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.gogrid.functions.internal;
20 
21import java.lang.reflect.Type;
22 
23import org.jclouds.gogrid.domain.IpState;
24import org.jclouds.gogrid.domain.JobState;
25import org.jclouds.gogrid.domain.LoadBalancerOs;
26import org.jclouds.gogrid.domain.LoadBalancerPersistenceType;
27import org.jclouds.gogrid.domain.LoadBalancerState;
28import org.jclouds.gogrid.domain.LoadBalancerType;
29import org.jclouds.gogrid.domain.ObjectType;
30import org.jclouds.gogrid.domain.ServerImageState;
31import org.jclouds.gogrid.domain.ServerImageType;
32import org.jclouds.gogrid.domain.ServerState;
33 
34import com.google.gson.JsonDeserializationContext;
35import com.google.gson.JsonDeserializer;
36import com.google.gson.JsonElement;
37import com.google.gson.JsonObject;
38import com.google.gson.JsonParseException;
39 
40/**
41 * @author Oleksiy Yarmula
42 */
43public class CustomDeserializers {
44 
45   public static class ServerStateAdapter implements JsonDeserializer<ServerState> {
46      @Override
47      public ServerState deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
48            throws JsonParseException {
49         String name = ((JsonObject) jsonElement).get("name").getAsString();
50         return ServerState.fromValue(name);
51      }
52   }
53 
54   public static class ObjectTypeAdapter implements JsonDeserializer<ObjectType> {
55      @Override
56      public ObjectType deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
57            throws JsonParseException {
58         String name = ((JsonObject) jsonElement).get("name").getAsString();
59         return ObjectType.fromValue(name);
60      }
61   }
62 
63   public static class LoadBalancerOsAdapter implements JsonDeserializer<LoadBalancerOs> {
64      @Override
65      public LoadBalancerOs deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
66            throws JsonParseException {
67         String name = ((JsonObject) jsonElement).get("name").getAsString();
68         return LoadBalancerOs.fromValue(name);
69      }
70   }
71 
72   public static class LoadBalancerStateAdapter implements JsonDeserializer<LoadBalancerState> {
73      @Override
74      public LoadBalancerState deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
75            throws JsonParseException {
76         String name = ((JsonObject) jsonElement).get("name").getAsString();
77         return LoadBalancerState.fromValue(name);
78      }
79   }
80 
81   public static class LoadBalancerPersistenceTypeAdapter implements JsonDeserializer<LoadBalancerPersistenceType> {
82      @Override
83      public LoadBalancerPersistenceType deserialize(JsonElement jsonElement, Type type,
84            JsonDeserializationContext context) throws JsonParseException {
85         String name = ((JsonObject) jsonElement).get("name").getAsString();
86         return LoadBalancerPersistenceType.fromValue(name);
87      }
88   }
89 
90   public static class LoadBalancerTypeAdapter implements JsonDeserializer<LoadBalancerType> {
91      @Override
92      public LoadBalancerType deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
93            throws JsonParseException {
94         String name = ((JsonObject) jsonElement).get("name").getAsString();
95         return LoadBalancerType.fromValue(name);
96      }
97   }
98 
99   public static class IpStateAdapter implements JsonDeserializer<IpState> {
100      @Override
101      public IpState deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
102            throws JsonParseException {
103         String name = ((JsonObject) jsonElement).get("name").getAsString();
104         return IpState.fromValue(name);
105      }
106   }
107 
108   public static class JobStateAdapter implements JsonDeserializer<JobState> {
109      @Override
110      public JobState deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
111            throws JsonParseException {
112         String name = ((JsonObject) jsonElement).get("name").getAsString();
113         return JobState.fromValue(name);
114      }
115   }
116 
117   public static class ServerImageStateAdapter implements JsonDeserializer<ServerImageState> {
118      @Override
119      public ServerImageState deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
120            throws JsonParseException {
121         String name = ((JsonObject) jsonElement).get("name").getAsString();
122         return ServerImageState.fromValue(name);
123      }
124   }
125 
126   public static class ServerImageTypeAdapter implements JsonDeserializer<ServerImageType> {
127      @Override
128      public ServerImageType deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
129            throws JsonParseException {
130         String name = ((JsonObject) jsonElement).get("name").getAsString();
131         return ServerImageType.fromValue(name);
132      }
133   }
134 
135}

[all classes][org.jclouds.gogrid.functions.internal]
EMMA 2.0.5312 (C) Vladimir Roubtsov