1 26 package org.objectweb.util.explorer.context.lib; 27 28 import org.objectweb.util.explorer.api.Context; 29 import org.objectweb.util.explorer.api.Entry; 30 import org.objectweb.util.explorer.context.api.Decoder; 31 import org.objectweb.util.explorer.context.api.DecoderManager; 32 import org.objectweb.util.explorer.core.common.lib.DefaultContext; 33 34 42 public class DecoderContext 43 implements Context, DecoderManager 44 { 45 46 52 protected Context delegate_ = null; 53 54 protected Decoder decoder_ = null; 55 56 62 65 public DecoderContext(){ 66 this(new DefaultContext()); 67 } 68 69 72 public DecoderContext(Context delegate){ 73 if(delegate!=null) 74 delegate_ = delegate; 75 else 76 delegate_ = new DefaultContext(); 77 } 78 79 85 91 94 public Entry[] getEntries(Object object) { 95 Entry[] entries = delegate_.getEntries(object); 96 if(entries!=null && decoder_!=null){ 97 for (int i = 0; i < entries.length; i++) { 98 Object obj = decoder_.decode(entries[i].getValue()); 99 entries[i].setValue(obj); 100 } 101 } 102 return entries; 103 } 104 105 111 114 public void setDecoder(Decoder decoder) { 115 decoder_ = decoder; 116 } 117 118 } 119 | Popular Tags |