Package com.google.gson

Examples of com.google.gson.GsonBuilder


   
    return desc;
  }
 
  public String toString() {
    Gson gson = new GsonBuilder().setPrettyPrinting().
        excludeFieldsWithoutExposeAnnotation().create();
    return gson.toJson(this);
  }
View Full Code Here


    /**
     * Creates a new {@link RESTClientServlet} instance.
     */
    public RESTClientServlet() {
        m_gson = (new GsonBuilder())
            .registerTypeHierarchyAdapter(RepositoryObject.class, new RepositoryObjectSerializer())
            .registerTypeHierarchyAdapter(LogEvent.class, new LogEventSerializer())
            .create();
       
        m_workspaces = new HashMap<String, Workspace>();
View Full Code Here

        .initParam("com.sun.jersey.api.json.POJOMappingFeature", "true")
        .build());
  }

  public static <T> T getJsonFormString(String json, Class<T> type) {
    GsonBuilder gsonBuilder = new GsonBuilder();
    gsonBuilder.serializeNulls();
    Gson gson = gsonBuilder.create();
    return (T) gson.fromJson(json, type);
  }
View Full Code Here

    public ConsoleProxyClientStatsCollector(Hashtable<String, ConsoleProxyClient> connMap) {
        setConnections(connMap);
    }
   
    public String getStatsReport() {
        Gson gson = new GsonBuilder().setPrettyPrinting().create();
        return gson.toJson(this);
    }
View Full Code Here

        Gson gson = new GsonBuilder().setPrettyPrinting().create();
        return gson.toJson(this);
    }
   
    public void getStatsReport(OutputStreamWriter os) {
        Gson gson = new GsonBuilder().setPrettyPrinting().create();
        gson.toJson(this, os);
    }
View Full Code Here

    private boolean hasPreviousSession(ConsoleProxyVO proxy, VMInstanceVO vm) {

        ConsoleProxyStatus status = null;
        try {
            GsonBuilder gb = new GsonBuilder();
            gb.setVersion(1.3);
            Gson gson = gb.create();

            byte[] details = proxy.getSessionDetails();
            status = gson.fromJson(details != null ? new String(details, Charset.forName("US-ASCII")) : null, ConsoleProxyStatus.class);
        } catch (Throwable e) {
            s_logger.warn("Unable to parse proxy session details : " + proxy.getSessionDetails());
View Full Code Here

            return;
        }

        ConsoleProxyStatus status = null;
        try {
            GsonBuilder gb = new GsonBuilder();
            gb.setVersion(1.3);
            Gson gson = gb.create();
            status = gson.fromJson(answer.getDetails(), ConsoleProxyStatus.class);
        } catch (Throwable e) {
            s_logger.warn("Unable to parse load info from proxy, proxy vm id : " + answer.getProxyVmId() + ", info : " + answer.getDetails());
        }
View Full Code Here

                return;
            }

            ConsoleProxyStatus status = null;
            try {
                GsonBuilder gb = new GsonBuilder();
                gb.setVersion(1.3);
                Gson gson = gb.create();
                status = gson.fromJson(cmd.getLoadInfo(), ConsoleProxyStatus.class);
            } catch (Throwable e) {
                s_logger.warn("Unable to parse load info from proxy, proxy vm id : " + cmd.getProxyVmId() + ", info : " + cmd.getLoadInfo());
            }
View Full Code Here

        } else {
          break;
        }
      }

    Gson gson = new GsonBuilder().create();
    return gson.toJson(keyIvPair);
    }
View Full Code Here

 
  // key/IV will be set in 128 bit strength
  private KeyIVPair keyIvPair;
 
  public ConsoleProxyPasswordBasedEncryptor(String password) {
    gson = new GsonBuilder().create();
    keyIvPair = gson.fromJson(password, KeyIVPair.class);
  }
View Full Code Here

TOP

Related Classes of com.google.gson.GsonBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.