1 29 30 package com.caucho.iiop.orb; 31 32 import java.util.HashMap ; 33 34 37 public class MarshalFactory { 38 private static MarshalFactory _factory = new MarshalFactory(); 39 40 private static HashMap <Class ,Marshal> _classMap 41 = new HashMap <Class ,Marshal>(); 42 43 public static MarshalFactory create() 44 { 45 return _factory; 46 } 47 48 public Marshal create(Class cl) 49 { 50 Marshal marshal = _classMap.get(cl); 51 52 if (marshal != null) 53 return marshal; 54 55 if (java.io.Serializable .class.isAssignableFrom(cl)) 56 return SerializableMarshal.MARSHAL; 57 58 throw new UnsupportedOperationException (cl.getName()); 59 } 60 61 static { 62 _classMap.put(String .class, StringMarshal.MARSHAL); 63 _classMap.put(org.omg.CORBA.Object .class, CorbaObjectMarshal.MARSHAL); 64 } 65 } 66 | Popular Tags |