]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/scratch/org/simantics/databoard/tests/Jotakin15.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / scratch / org / simantics / databoard / tests / Jotakin15.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
3  * Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.databoard.tests;
13
14 import java.util.TreeMap;
15 import java.util.TreeSet;
16
17 import org.simantics.databoard.Bindings;
18 import org.simantics.databoard.annotations.Name;
19 import org.simantics.databoard.binding.Binding;
20 import org.simantics.databoard.serialization.Serializer;
21
22 public class Jotakin15 {
23         
24         static class XClass {
25                 
26                 public @Name("Field1") TreeMap<String, Integer> xyz1 = new TreeMap<String, Integer>();
27                 public TreeSet<String> xyz2 = new TreeSet<String>();
28                 public TreeMap<String, Integer[]> xyz3 = new TreeMap<String, Integer[]>();
29                 public TreeMap<String, Integer[][]> xyz4 = new TreeMap<String, Integer[][]>();
30                 public TreeMap<String, int[][]> xyz5 = new TreeMap<String, int[][]>();
31                 
32                 
33         }
34         
35         public static void main(String[] args) throws Exception {
36                 
37                 Binding bing = Bindings.getBindingUnchecked( XClass.class );
38                 System.out.println(bing.type());
39                 Serializer sers = Bindings.getSerializer( bing );
40                 
41                 XClass x = new XClass();
42                 //x.xyz1.put("x", 3);
43 //              x.xyz2.add("y");
44                 
45                 byte[] data = sers.serialize( x );
46                 
47                 XClass y = (XClass) sers.deserialize( data );
48                 System.out.println(bing.toString(y));
49                 
50         }
51
52 }