javax.xml.rpc.encoding.DeserializerFactory Java Examples

The following examples show how to use javax.xml.rpc.encoding.DeserializerFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AxisDeserializer.java    From googleads-java-lib with Apache License 2.0 6 votes vote down vote up
/** Adds the type mappings in the list to {@code registryTypeMapping}. */
private void registerTypeMappings(
    TypeMapping registryTypeMapping, List<TypeMapping> typeMappings) {
  Preconditions.checkNotNull(registryTypeMapping, "Null registry type mapping");
  Preconditions.checkNotNull(typeMappings, "Null type mappings");
  Preconditions.checkArgument(!typeMappings.isEmpty(), "Empty type mappings");
  for (TypeMapping typeMapping : typeMappings) {
    for (Class<?> mappingClass : typeMapping.getAllClasses()) {
      QName classQName = typeMapping.getTypeQName(mappingClass);
      DeserializerFactory deserializer = typeMapping.getDeserializer(mappingClass, classQName);
      if (deserializer != null && !registryTypeMapping.isRegistered(mappingClass, classQName)) {
        registryTypeMapping.register(
            mappingClass, classQName, (SerializerFactory) null, deserializer);
      }
    }
  }
}
 
Example #2
Source File: ContextRegistrar.java    From openbd-core with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Registers the specified Class with the current MessageContext's TypeMapping
 * for use by Axis. This method will remove any existing entries for the same
 * class type (QName equivalence) before adding new Bean
 * serializer/deserializer entries.
 * 
 * @param kls
 */
public void registerClass(Class<?> kls) {
	// Add ser/deser pairs for these classes
	TypeMapping tm = msgContext.getTypeMapping();
	QName xmlType = convertToQName(kls, this.scheme);
	if (!tm.isRegistered(kls, xmlType)) {
		SerializerFactory sf = new BeanSerializerFactory(kls, xmlType);
		DeserializerFactory dsf = new BeanDeserializerFactory(kls, xmlType);
		tm.register(kls, xmlType, sf, dsf);
	}
}
 
Example #3
Source File: TypeInfo.java    From tomee with Apache License 2.0 4 votes vote down vote up
public void register(TypeMapping typeMapping) {
    SerializerFactory ser = BaseSerializerFactory.createFactory(serFactoryClass, clazz, qName);
    DeserializerFactory deser = BaseDeserializerFactory.createFactory(deserFactoryClass, clazz, qName);

    typeMapping.register(clazz, qName, ser, deser);
}
 
Example #4
Source File: JavaServiceDescBuilder.java    From tomee with Apache License 2.0 4 votes vote down vote up
private void registerType(JaxRpcTypeInfo type, TypeMapping typeMapping) throws OpenEJBException {
    Class javaType;
    try {
        javaType = classLoader.loadClass(type.javaType);
    } catch (ClassNotFoundException e) {
        throw new OpenEJBException("Could not load class for JaxRpc mapping " + type.javaType);
    }

    // Default uses the generic Java Beans serializer/deserializer
    Class serializerFactoryClass = BeanSerializerFactory.class;
    Class deserializerFactoryClass = BeanDeserializerFactory.class;
    switch (type.serializerType) {
        case ARRAY:
            serializerFactoryClass = ArraySerializerFactory.class;
            deserializerFactoryClass = ArrayDeserializerFactory.class;
            break;
        case ENUM:
            serializerFactoryClass = EnumSerializerFactory.class;
            deserializerFactoryClass = EnumDeserializerFactory.class;
            break;
        case LIST:
            serializerFactoryClass = SimpleListSerializerFactory.class;
            deserializerFactoryClass = SimpleListDeserializerFactory.class;
            break;
        default:
            if (type.simpleBaseType != null) {
                Class clazz = SOAP_TYPE_MAPPING.getClassForQName(type.simpleBaseType, null, null);
                if (null != clazz) {
                    // Built in SOAP type
                    serializerFactoryClass = SOAP_TYPE_MAPPING.getSerializer(clazz, type.simpleBaseType).getClass();
                    deserializerFactoryClass = SOAP_TYPE_MAPPING.getDeserializer(clazz, type.simpleBaseType, null).getClass();
                } else {
                    clazz = JAXRPC_TYPE_MAPPING.getClassForQName(type.simpleBaseType, null, null);
                    if (null != clazz) {
                        // Built in XML schema type
                        serializerFactoryClass = JAXRPC_TYPE_MAPPING.getSerializer(clazz, type.simpleBaseType).getClass();
                        deserializerFactoryClass = JAXRPC_TYPE_MAPPING.getDeserializer(clazz, type.simpleBaseType, null).getClass();
                    }
                }
            }
            break;
    }

    SerializerFactory serializerFactory = BaseSerializerFactory.createFactory(serializerFactoryClass, javaType, type.qname);
    DeserializerFactory deserializerFactory = BaseDeserializerFactory.createFactory(deserializerFactoryClass, javaType, type.qname);

    typeMapping.register(javaType, type.qname, serializerFactory, deserializerFactory);
}