1 package org.codehaus.xfire.java.mapping; 2 3 /*** 4 * The TypeMappingRegistry provides access to the type mappings within XFire. 5 * 6 * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a> 7 * @since Feb 18, 2004 8 */ 9 public interface TypeMappingRegistry 10 { 11 final public static String ROLE = TypeMappingRegistry.class.getName(); 12 13 /*** 14 */ 15 public TypeMapping register(String encodingStyleURI, TypeMapping mapping); 16 17 /*** 18 */ 19 public void registerDefault(TypeMapping mapping); 20 21 /*** 22 * Gets the registered default <code>TypeMapping</code> instance. 23 * This method returns <code>null</code> if there is no registered 24 * default TypeMapping in the registry. 25 * 26 * @return The registered default <code>TypeMapping</code> instance 27 * or <code>null</code>. 28 */ 29 public TypeMapping getDefaultTypeMapping(); 30 31 /*** 32 * Returns a list of registered encodingStyle URIs in this 33 * <code>TypeMappingRegistry</code> instance. 34 * 35 * @return Array of the registered encodingStyle URIs 36 */ 37 public String[] getRegisteredEncodingStyleURIs(); 38 39 /*** 40 * Returns the registered <code>TypeMapping</code> for the specified 41 * encodingStyle URI. If there is no registered <code>TypeMapping</code> 42 * for the specified <code>encodingStyleURI</code>, this method 43 * returns <code>null</code>. 44 * 45 * @param encodingStyleURI Encoding style specified as an URI 46 * @return TypeMapping for the specified encodingStyleURI or 47 * <code>null</code> 48 */ 49 public TypeMapping getTypeMapping(String encodingStyleURI); 50 51 /*** 52 * Creates a new empty <code>TypeMapping</code> object. 53 * 54 * @return TypeMapping instance. 55 */ 56 public TypeMapping createTypeMapping(boolean autoTypes); 57 58 /*** 59 * Create a type mapping with the specified encodying style. 60 * 61 * @param parentTM The parent type mapping. Often a namespace. 62 * @return 63 */ 64 public TypeMapping createTypeMapping(String encodingStyleURI, boolean autoTypes); 65 66 /*** 67 * Unregisters a TypeMapping instance, if present, from the specified 68 * encodingStyleURI. 69 * 70 * @param encodingStyleURI Encoding style specified as an URI 71 * @return <code>TypeMapping</code> instance that has been unregistered 72 * or <code>null</code> if there was no TypeMapping 73 * registered for the specified <code>encodingStyleURI</code> 74 */ 75 public TypeMapping unregisterTypeMapping(String encodingStyleURI); 76 77 /*** 78 * Removes a <code>TypeMapping</code> from the TypeMappingRegistry. A 79 * <code>TypeMapping</code> is associated with 1 or more 80 * encodingStyleURIs. This method unregisters the specified 81 * <code>TypeMapping</code> instance from all associated 82 * <code>encodingStyleURIs</code> and then removes this 83 * TypeMapping instance from the registry. 84 * 85 * @param mapping TypeMapping to remove 86 * @return <code>true</code> if specified <code>TypeMapping</code> 87 * is removed from the TypeMappingRegistry; <code>false</code> 88 * if the specified <code>TypeMapping</code> was not in the 89 * <code>TypeMappingRegistry</code> 90 */ 91 public boolean removeTypeMapping(TypeMapping mapping); 92 93 /*** 94 * Removes all registered TypeMappings and encodingStyleURIs 95 * from this TypeMappingRegistry. 96 */ 97 public void clear(); 98 }