tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > SOJO > Set Key Property

Set Key Property 

SOJO (Simplified Old Java Objects) is a Java framework which converts object graph into a specific structure or representation. This requires the library sojo-1.0.0.jar to be in classpath. The following example shows using PathExecuter.setKeyProperty() API.

File Name  :  
com/bethecoder/tutorials/sojo/tests/SetKeyOGN.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.sojo.tests;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import net.sf.sojo.navigation.PathExecuter;

public class SetKeyOGN {

  /**
   @param args
   */
  public static void main(String[] argsthrows IOException {
    
    Map<String, Object> mapData = new HashMap<String, Object>();
    mapData.put("name""Sriram");
    mapData.put("age"2);
    mapData.put("hobby""painting");
    System.out.println(mapData);
    
    PathExecuter.setKeyProperty(mapData, "name""Sriram Kasireddi");
    PathExecuter.setKeyProperty(mapData, "age"4);
    System.out.println(mapData);
  }
}
   

It gives the following output,
{age=2, name=Sriram, hobby=painting}
{age=4, name=Sriram Kasireddi, hobby=painting}



 
  


  
bl  br