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

Get 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.getKeyProperty() API.

File Name  :  
com/bethecoder/tutorials/sojo/tests/GetKeyOGN.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 GetKeyOGN {

  /**
   @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");
    
    String name = (StringPathExecuter.getKeyProperty(mapData, "name");
    System.out.println("name = " + name);
    
    Integer age = (IntegerPathExecuter.getKeyProperty(mapData, "age");
    System.out.println("age = " + age);
  }
}
   

It gives the following output,
name = Sriram
age = 2



 
  


  
bl  br