Examples of JsonFormat


Examples of com.fasterxml.jackson.annotation.JsonFormat

    }

    protected void generateCommonPropertyParameters( SourceWriter source, PropertyInfo property,
                                                     JMapperType mapperType ) throws UnableToCompleteException {
        if ( property.getFormat().isPresent() ) {
            JsonFormat format = property.getFormat().get();
            if ( !Strings.isNullOrEmpty( format.pattern() ) ) {
                source.println();
                source.print( ".setPattern(\"%s\")", format.pattern() );
            }
            source.println();
            source.print( ".setShape(%s.%s)", Shape.class.getCanonicalName(), format.shape().name() );
            if ( !Strings.isNullOrEmpty( format.locale() ) && !JsonFormat.DEFAULT_LOCALE.equals( format.locale() ) ) {
                logger.log( Type.WARN, "JsonFormat.locale is not supported by default" );
                source.println();
                source.print( ".setLocale(\"%s\")", format.locale() );
            }
            if ( !Strings.isNullOrEmpty( format.timezone() ) && !JsonFormat.DEFAULT_TIMEZONE.equals( format.timezone() ) ) {
                logger.log( Type.WARN, "JsonFormat.timezone is not supported by default" );
                source.println();
                source.print( ".setTimezone(\"%s\")", format.timezone() );
            }
        }
        if ( property.getIgnoredProperties().isPresent() ) {
            for ( String ignoredProperty : property.getIgnoredProperties().get() ) {
                source.println();
View Full Code Here

Examples of org.geoserver.rest.JSONFormat

        return myUserService;
    }

    public Map getSupportedFormats() {
        Map theMap = new HashMap();
        theMap.put("json", new JSONFormat());
        theMap.put("html", new UserHTMLFormat("HTMLTemplates/user.ftl"));
        theMap.put("xml", new UserXMLFormat("XMLTemplates/user.ftl"));
        theMap.put(null, theMap.get("html"));

        return theMap;
View Full Code Here

Examples of org.geoserver.rest.JSONFormat

        return myUserService;
    }

    public Map getSupportedFormats() {
        Map theMap = new HashMap();
        theMap.put("json", new JSONFormat());
        theMap.put("html", new FreemarkerFormat("HTMLTemplates/users.ftl", getClass(), MediaType.TEXT_HTML));
        theMap.put("xml", new AutoXMLFormat());
        theMap.put(null, theMap.get("html"));

        return theMap;
View Full Code Here

Examples of org.nutz.json.JsonFormat

        String model = "{'name':'姓名', 'age':'年龄'}";
        String dest = "{\"姓名\":\"jk\",\"年龄\":12}";
        Object obj = Mapl.convert(Json.fromJson(Lang.inr(json)), Lang.inr(model));
        assertEquals("jk", Mapl.cell(obj, "姓名"));
        assertEquals(12, Mapl.cell(obj, "年龄"));
        assertEquals(dest, Json.toJson(obj, new JsonFormat()));
    }
View Full Code Here

Examples of org.nutz.json.JsonFormat

        Object obj = Mapl.convert(Json.fromJson(Lang.inr(json)), Lang.inr(model));
        assertEquals("jk", Mapl.cell(obj, "user[0].姓名"));
        assertEquals("nutz", Mapl.cell(obj, "user[1].姓名"));
        assertEquals("jk", Mapl.cell(obj, "people[0].name"));
        assertEquals(5, Mapl.cell(obj, "people[1].age"));
        assertEquals(dest, Json.toJson(obj, new JsonFormat()));
    }
View Full Code Here

Examples of org.nutz.json.JsonFormat

        String model = "{'user':[{'name':['[].name'], 'age':'[].age'}]}";
        String dest = "[{\"age\":12,\"name\":\"jk\"}, {\"age\":5,\"name\":\"nutz\"}]";
        Object obj = Mapl.convert(Json.fromJson(Lang.inr(json)), Lang.inr(model));
        assertEquals("jk", Mapl.cell(obj, "[0].name"));
        assertEquals(5, Mapl.cell(obj, "[1].age"));
        assertEquals(dest, Json.toJson(obj, new JsonFormat()));
    }
View Full Code Here

Examples of org.nutz.json.JsonFormat

    @Test
    public void testIssue322() {
        String json = "{name:'nutz', age:12, address:[{area:1,name:'abc'},{area:2,name:'123'}]}";
        Object obj = Json.fromJson(json);
        Object newobj = Mapl.excludeFilter(obj, Lang.list("age", "address[].area"));
        JsonFormat jf = new JsonFormat(true);
        assertEquals("{\"address\":[{\"name\":\"abc\"}, {\"name\":\"123\"}],\"name\":\"nutz\"}",
                     Json.toJson(newobj, jf));
    }
View Full Code Here

Examples of org.nutz.json.JsonFormat

*/
public class JsonConvertImpl implements MaplConvert{
    private JsonFormat format = null;
   
    public JsonConvertImpl() {
        format = new JsonFormat();
    }
View Full Code Here

Examples of org.nutz.json.JsonFormat

    }

    private JsonFormat format = null;

    public JsonConvertImpl() {
        format = new JsonFormat();
    }
View Full Code Here

Examples of org.nutz.json.JsonFormat

        String model = "{'name':'姓名', 'age':'年龄'}";
        String dest = "{\"姓名\":\"jk\",\"年龄\":12}";
        Object obj = Mapl.convert(Json.fromJson(Lang.inr(json)), Lang.inr(model));
        assertEquals("jk", Mapl.cell(obj, "姓名"));
        assertEquals(12, Mapl.cell(obj, "年龄"));
        assertEquals(dest, Json.toJson(obj, new JsonFormat()));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.