tinkerpop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TINKERPOP-1274) GraphSON Version 2.0
Date Fri, 01 Jul 2016 20:56:11 GMT

    [ https://issues.apache.org/jira/browse/TINKERPOP-1274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15359614#comment-15359614
] 

ASF GitHub Bot commented on TINKERPOP-1274:
-------------------------------------------

Github user newkek commented on the issue:

    https://github.com/apache/tinkerpop/pull/351
  
    @spmallette yes, maybe some code will help explain.
    
    ```
            ObjectMapper mapper = GraphSONMapper.build().version(GraphSONVersion.V2_0).typeInfo(GraphSONMapper.TypeInfo.PARTIAL_TYPES).create().createMapper();
            Map<String, Integer> map = new HashMap<>();
            map.put("helo", 2);
    
    
            String s = mapper.writeValueAsString(map);
    
            // prints 's = {"helo":2}'
            System.out.println("s = " + s);
    
            Map read = mapper.readValue(s, Map.class);
    
            // prints 'read.get("helo") = class java.lang.Integer'
            System.out.println("read.get(\"helo\") = " + read.get("helo").getClass());
    
            Map<String, Long> map3 = new HashMap<>();
            map3.put("helo", 2L);
    
    
            String s2 = mapper.writeValueAsString(map3);
    
            // prints 's2 = {"helo":[{"@class":"Long"},2]}'
            System.out.println("s2 = " + s2);
    
            Map read2 = mapper.readValue(s2, Map.class);
    
            // prints 'read2.get("helo") = class java.lang.Long'
            System.out.println("read2.get(\"helo\") = " + read2.get("helo").getClass());
    ```
    
    > number with decimal and no type = Java Float
    
    Almost, by default decimals are Double, not Floats.


> GraphSON Version 2.0
> --------------------
>
>                 Key: TINKERPOP-1274
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1274
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: io
>    Affects Versions: 3.1.2-incubating
>            Reporter: stephen mallette
>            Priority: Minor
>             Fix For: 3.2.1
>
>
> Develop a revised version of GraphSON that provides better support for non-JVM languages
that consume it. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message