Examples of HintMap


Examples of org.kite9.diagram.primitives.HintMap

      // this compacts the representation of a hint map, which is
      // otherwise excessive
      xstream.registerConverter(new Converter() {

        public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
          HintMap map = (HintMap) source;
          for (Iterator<Entry<String, Float>> iterator = map.entrySet().iterator(); iterator.hasNext();) {
            Entry<String, Float> entry = iterator.next();
            writer.addAttribute(entry.getKey().toString(), entry.getValue().toString());
          }
        }

        @SuppressWarnings("unchecked")
        public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
          HintMap properties = new HintMap();
          for (Iterator iterator = reader.getAttributeNames(); iterator.hasNext();) {
            String n = (String) iterator.next();
            String v = reader.getAttribute(n);
            Float f = Float.parseFloat(v);
            properties.put(n, f);
          }

          return properties;
        }
       
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.