Search in sources :

Example 1 with PropertySetter

use of com.sun.xml.ws.spi.db.PropertySetter in project metro-jax-ws by eclipse-ee4j.

the class SDOWrapperAccessor method initBuilders.

protected void initBuilders() {
    HashMap<Object, PropertySetter> setByQName = new HashMap<>();
    HashMap<Object, PropertyGetter> getByQName = new HashMap<>();
    HashMap<Object, PropertySetter> setByLocalpart = new HashMap<>();
    HashMap<Object, PropertyGetter> getByLocalpart = new HashMap<>();
    HashSet<String> elementLocalNames = new HashSet<>();
    TypeHelper helper = contextWrapper.getHelperContext().getTypeHelper();
    Type type = helper.getType(contentClass);
    @SuppressWarnings("unchecked") List<Property> properties = (List<Property>) type.getDeclaredProperties();
    for (Property p : properties) {
        QName qname = SDOUtils.getPropertyElementName(contextWrapper.getHelperContext(), p);
        SDOPropertyBuilder pBuilder = new SDOPropertyBuilder(qname, p.getType().getInstanceClass());
        setByQName.put(qname, pBuilder);
        getByQName.put(qname, pBuilder);
        setByLocalpart.put(qname.getLocalPart(), pBuilder);
        getByLocalpart.put(qname.getLocalPart(), pBuilder);
        if (elementLocalNames.contains(qname.getLocalPart())) {
            elementLocalNameCollision = true;
        } else {
            elementLocalNames.add(qname.getLocalPart());
        }
    }
    if (elementLocalNameCollision) {
        propertySetters = setByQName;
        propertyGetters = getByQName;
    } else {
        propertySetters = setByLocalpart;
        propertyGetters = getByLocalpart;
    }
}
Also used : TypeHelper(commonj.sdo.helper.TypeHelper) HashMap(java.util.HashMap) PropertySetter(com.sun.xml.ws.spi.db.PropertySetter) QName(javax.xml.namespace.QName) Type(commonj.sdo.Type) PropertyGetter(com.sun.xml.ws.spi.db.PropertyGetter) DataObject(commonj.sdo.DataObject) List(java.util.List) Property(commonj.sdo.Property) HashSet(java.util.HashSet)

Aggregations

PropertyGetter (com.sun.xml.ws.spi.db.PropertyGetter)1 PropertySetter (com.sun.xml.ws.spi.db.PropertySetter)1 DataObject (commonj.sdo.DataObject)1 Property (commonj.sdo.Property)1 Type (commonj.sdo.Type)1 TypeHelper (commonj.sdo.helper.TypeHelper)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 QName (javax.xml.namespace.QName)1