001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019 020 package javax.xml.rpc.encoding; 021 022 import javax.xml.namespace.QName; 023 024 /** 025 * The <code>javax.xml.rpc.encoding.TypeMapping</code> is the base 026 * interface for the representation of a type mapping. A TypeMapping 027 * implementation class may support one or more encoding styles. 028 * <p> 029 * For its supported encoding styles, a TypeMapping instance 030 * maintains a set of tuples of the type {Java type, 031 * <code>SerializerFactory</code>, 032 * <code>DeserializerFactory</code>, XML type}. 033 * 034 * @version $Rev: 467553 $ $Date: 2006-10-25 00:01:51 -0400 (Wed, 25 Oct 2006) $ 035 */ 036 public interface TypeMapping { 037 038 /** 039 * Returns the encodingStyle URIs (as String[]) supported by 040 * this TypeMapping instance. A TypeMapping that contains only 041 * encoding style independent serializers and deserializers 042 * returns <code>null</code> from this method. 043 * 044 * @return Array of encodingStyle URIs for the supported 045 * encoding styles 046 */ 047 public String[] getSupportedEncodings(); 048 049 /** 050 * Sets the encodingStyle URIs supported by this TypeMapping 051 * instance. A TypeMapping that contains only encoding 052 * independent serializers and deserializers requires 053 * <code>null</code> as the parameter for this method. 054 * 055 * @param encodingStyleURIs Array of encodingStyle URIs for the 056 * supported encoding styles 057 */ 058 public void setSupportedEncodings(String[] encodingStyleURIs); 059 060 /** 061 * Checks whether or not type mapping between specified XML 062 * type and Java type is registered. 063 * 064 * @param javaType Class of the Java type 065 * @param xmlType Qualified name of the XML data type 066 * @return boolean; <code>true</code> if type mapping between the 067 * specified XML type and Java type is registered; 068 * otherwise <code>false</code> 069 */ 070 public boolean isRegistered(Class javaType, QName xmlType); 071 072 /** 073 * Registers SerializerFactory and DeserializerFactory for a 074 * specific type mapping between an XML type and Java type. 075 * This method replaces any existing registered SerializerFactory 076 * DeserializerFactory instances. 077 * 078 * @param javaType Class of the Java type 079 * @param xmlType Qualified name of the XML data type 080 * @param sf SerializerFactory 081 * @param dsf DeserializerFactory 082 * 083 * @throws javax.xml.rpc.JAXRPCException if there are any errors that 084 * prevent registration 085 */ 086 public void register(Class javaType, QName xmlType, SerializerFactory sf, 087 DeserializerFactory dsf); 088 089 /** 090 * Gets the SerializerFactory registered for the specified 091 * pair of Java type and XML data type. 092 * 093 * @param javaType Class of the Java type 094 * @param xmlType Qualified name of the XML data type 095 * 096 * @return Registered SerializerFactory or <code>null</code> 097 * if there is no registered factory 098 */ 099 public SerializerFactory getSerializer(Class javaType, QName xmlType); 100 101 /** 102 * Gets the DeserializerFactory registered for the specified pair 103 * of Java type and XML data type. 104 * 105 * @param javaType Class of the Java type 106 * @param xmlType Qualified name of the XML data type 107 * 108 * @return Registered SerializerFactory or <code>null</code> 109 * if there is no registered factory 110 */ 111 public DeserializerFactory getDeserializer(Class javaType, QName xmlType); 112 113 /** 114 * Removes the SerializerFactory registered for the specified 115 * pair of Java type and XML data type. 116 * 117 * @param javaType Class of the Java type 118 * @param xmlType Qualified name of the XML data type 119 * 120 * @throws javax.xml.rpc.JAXRPCException if there is any error that prevents 121 * removal of the registered SerializerFactory 122 */ 123 public void removeSerializer(Class javaType, QName xmlType); 124 125 /** 126 * Removes the DeserializerFactory registered for the specified 127 * pair of Java type and XML data type. 128 * 129 * @param javaType Class of the Java type 130 * @param xmlType Qualified name of the XML data type 131 * 132 * @throws javax.xml.rpc.JAXRPCException if there is any error in removing 133 * the registered DeserializerFactory 134 */ 135 public void removeDeserializer(Class javaType, QName xmlType); 136 } 137