1 26 27 package org.objectweb.util.browser.core.naming; 28 29 30 import org.objectweb.util.browser.api.Context; 31 import org.objectweb.util.browser.api.Entry; 32 import org.objectweb.util.browser.core.api.Decoder; 33 import org.objectweb.util.browser.core.api.DecoderFactory; 34 35 42 public class DefaultDecoderFactory 43 implements DecoderFactory { 44 45 51 57 63 69 73 public Decoder create(Context factoryConfig) { 74 Decoder decoder = null; 75 if (factoryConfig != null) { 76 Entry[] entries = factoryConfig.getEntries(); 77 for (int i = 0; i < entries.length; i++) { 78 Entry entry = entries[i]; 79 Class c = (Class ) entry.getValue(); 80 try { 81 if (Decoder.class.isAssignableFrom(c)) { 82 Decoder newDecoder = (Decoder) c.newInstance(); 83 newDecoder.setNext(decoder); 84 decoder = newDecoder; 85 } 86 } catch (InstantiationException e1) { 87 System.out.println("Error : " + c.getName() + " : Instantiation exception !"); 88 } catch (IllegalAccessException e1) { 89 System.out.println("Error : " + c.getName() + " : Illegal access exception !"); 90 } 91 } 92 } 93 return decoder; 94 } 95 96 } 97 | Popular Tags |