1 4 package org.jfox.ioc.util; 5 6 import java.rmi.MarshalledObject ; 7 8 11 12 public class Marshaller { 13 public static MarshalledObject marshall(Object obj){ 14 if(obj == null) { 15 return null; 16 } 17 else if(obj instanceof MarshalledObject ){ 18 return (MarshalledObject )obj; 19 } 20 else { 21 try { 22 return new MarshalledObject (obj); 23 } 24 catch(Exception e){ 25 e.printStackTrace(); 26 return null; 27 } 28 } 29 } 30 31 public static Object unmarshall(Object obj){ 32 if(obj == null) { 33 return null; 34 } 35 else if(obj instanceof MarshalledObject ){ 36 try { 37 return ((MarshalledObject )obj).get(); 38 } 39 catch(Exception e){ 40 e.printStackTrace(); 41 return null; 42 } 43 } 44 else { 45 return obj; 46 } 47 } 48 49 public static void main(String [] args) { 50 51 } 52 } 53 54 | Popular Tags |