1 29 30 package com.caucho.config.jaxb; 31 32 import com.caucho.config.AttributeStrategy; 33 import com.caucho.config.ConfigException; 34 import com.caucho.config.NodeBuilder; 35 import com.caucho.config.TypeStrategy; 36 import com.caucho.xml.QName; 37 38 import org.w3c.dom.Node ; 39 40 import javax.xml.bind.annotation.adapters.XmlAdapter; 41 import java.util.List ; 42 43 public class AdapterType extends TypeStrategy { 44 private final TypeStrategy _valueType; 45 private final XmlAdapter _adapter; 46 47 public AdapterType(TypeStrategy valueType, 48 XmlAdapter adapter) 49 { 50 _valueType = valueType; 51 _adapter = adapter; 52 } 53 54 57 public Class getType() 58 { 59 return List .class; 60 } 61 62 65 public String getTypeName() 66 { 67 return getType().getName(); 68 } 69 70 77 public Object configure(NodeBuilder builder, Node node, Object parent) 78 throws Exception 79 { 80 Object bean = _valueType.configure(builder, node, parent); 81 82 return _adapter.unmarshal(bean); 83 } 84 85 92 public AttributeStrategy getAttributeStrategy(QName attrName) 93 throws Exception 94 { 95 return _valueType.getAttributeStrategy(attrName); 96 } 97 } 98 | Popular Tags |