1 /* 2 * JBoss, Home of Professional Open Source. 3 * Copyright 2006, Red Hat Middleware LLC, and individual contributors 4 * as indicated by the @author tags. See the copyright.txt file in the 5 * distribution for a full listing of individual contributors. 6 * 7 * This is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU Lesser General Public License as 9 * published by the Free Software Foundation; either version 2.1 of 10 * the License, or (at your option) any later version. 11 * 12 * This software is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this software; if not, write to the Free 19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 21 */ 22 package javax.xml.rpc.encoding; 23 24 import javax.xml.namespace.QName; 25 26 /** 27 * This is the base interface for the representation of a type mapping. A 28 * TypeMapping implementation class may support one or more encoding styles. 29 * 30 * For its supported encoding styles, a TypeMapping instance maintains a set of 31 * tuples of the type {Java Class, SerializerFactory, DeserializerFactory, XML type-QName}. 32 * 33 * @author Scott.Stark@jboss.org 34 */ 35 public interface TypeMapping 36 { 37 38 /** 39 * Gets the DeserializerFactory registered for the specified pair of Java type and XML data type. 40 * @param javaType Class of the Java type 41 * @param xmlType QName of the XML type 42 * @return Registered DeserializerFactory or null if there is no registered factory 43 */ 44 public DeserializerFactory getDeserializer(Class javaType, QName xmlType); 45 46 /** 47 * Gets the SerializerFactory registered for the specified pair of Java type and XML data type. 48 * @param javaType Class of the Java type 49 * @param xmlType QName of the XML type 50 * @return Registered SerializerFactory or null if there is no registered factory 51 */ 52 public SerializerFactory getSerializer(Class javaType, QName xmlType); 53 54 /** 55 * Returns the encodingStyle URIs (as String[]) supported by this TypeMapping instance. 56 * A TypeMapping that contains only encoding style independent serializers and deserializers 57 * returns null from this method. 58 * 59 * @return Array of encodingStyle URIs for the supported encoding styles 60 */ 61 public String[] getSupportedEncodings(); 62 63 /** 64 * Sets the encodingStyle URIs supported by this TypeMapping instance. A TypeMapping that contains only encoding 65 * independent serializers and deserializers requires null as the parameter for this method. 66 * 67 * @param encodingStyleURIs Array of encodingStyle URIs for the supported encoding styles 68 */ 69 public void setSupportedEncodings(String[] encodingStyleURIs); 70 71 /** 72 * Checks whether or not type mapping between specified XML type and Java type is registered. 73 * @param javaType Class of the Java type 74 * @param xmlType QName of the XML type 75 * @return boolean; true if type mapping between the specified XML type and Java type is registered; otherwise false 76 */ 77 public boolean isRegistered(Class javaType, QName xmlType); 78 79 /** 80 * Registers SerializerFactory and DeserializerFactory for a specific type mapping between an XML type and Java type. 81 * This method replaces any existing registered SerializerFactory DeserializerFactory instances. 82 * @param javaType Class of the Java type 83 * @param xmlType QName of the XML type 84 * @param sf SerializerFactory 85 * @param dsf DeserializerFactory 86 * @throws javax.xml.rpc.JAXRPCException If any error during the registration 87 */ 88 public void register(Class javaType, QName xmlType, SerializerFactory sf, DeserializerFactory dsf); 89 90 /** 91 * Removes the DeserializerFactory registered for the specified pair of Java type and XML data type. 92 * @param javaType Class of the Java type 93 * @param xmlType QName of the XML type 94 * @throws javax.xml.rpc.JAXRPCException If there is error in removing the registered DeserializerFactory 95 */ 96 public void removeDeserializer(Class javaType, QName xmlType); 97 98 /** 99 * Removes the SerializerFactory registered for the specified pair of Java type and XML data type. 100 * @param javaType Class of the Java type 101 * @param xmlType QName of the XML type 102 * @throws javax.xml.rpc.JAXRPCException If there is error in removing the registered SerializerFactory 103 */ 104 public void removeSerializer(Class javaType, QName xmlType); 105 }