Package com.firefly.utils.json

Examples of com.firefly.utils.json.Parser


   
    PARSER_MAP.put(String[].class, new ArrayParser(String.class));
  }
 
  public static Parser getParser(Class<?> clazz) {
    Parser ret = PARSER_MAP.get(clazz);
    if(ret == null) {
      synchronized(LOCK) {
        ret = PARSER_MAP.get(clazz);
        if(ret == null) {
          if (clazz.isEnum()) {
View Full Code Here


    return ret;
  }
 
  @SuppressWarnings("unchecked")
  public static <T> T toObject(JsonReader reader, Class<?> clazz) throws IOException {
    Parser parser = getParser(clazz);
    return (T) parser.convertTo(reader, clazz);
  }
View Full Code Here

  public void test2() {
    ParserMetaInfo[] pp = DecodeCompiler.compile(CollectionObj.class);
    ParserMetaInfo p = pp[0];
    Assert.assertThat(p.getType().getName(), is(ArrayList.class.getName()));
   
    Parser parser = p.getParser();
    if(parser instanceof CollectionParser) {
      CollectionParser colp = (CollectionParser) parser;
      p = colp.getElementMetaInfo();
      Assert.assertThat(p.getType().getName(), is(LinkedList.class.getName()));
    }
View Full Code Here

    test(p);
  }
 
  public static void test(ParserMetaInfo p) {
    System.out.println(p.getType());
    Parser parser = p.getParser();
    if(parser instanceof CollectionParser) {
      CollectionParser colp = (CollectionParser) parser;
      test(colp.getElementMetaInfo());
    }
  }
View Full Code Here

TOP

Related Classes of com.firefly.utils.json.Parser

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.