1 package org.codehaus.xfire.type; 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 encodingStyleURI Encoding style specified as an URI 62 * @param autoTypes Should this mapping auto-generate types where possible 63 * @return TypeMapping instance 64 */ 65 public TypeMapping createTypeMapping(String encodingStyleURI, boolean autoTypes); 66 67 /*** 68 * Unregisters a TypeMapping instance, if present, from the specified 69 * encodingStyleURI. 70 * 71 * @param encodingStyleURI Encoding style specified as an URI 72 * @return <code>TypeMapping</code> instance that has been unregistered 73 * or <code>null</code> if there was no TypeMapping 74 * registered for the specified <code>encodingStyleURI</code> 75 */ 76 public TypeMapping unregisterTypeMapping(String encodingStyleURI); 77 78 /*** 79 * Removes a <code>TypeMapping</code> from the TypeMappingRegistry. A 80 * <code>TypeMapping</code> is associated with 1 or more 81 * encodingStyleURIs. This method unregisters the specified 82 * <code>TypeMapping</code> instance from all associated 83 * <code>encodingStyleURIs</code> and then removes this 84 * TypeMapping instance from the registry. 85 * 86 * @param mapping TypeMapping to remove 87 * @return <code>true</code> if specified <code>TypeMapping</code> 88 * is removed from the TypeMappingRegistry; <code>false</code> 89 * if the specified <code>TypeMapping</code> was not in the 90 * <code>TypeMappingRegistry</code> 91 */ 92 public boolean removeTypeMapping(TypeMapping mapping); 93 94 /*** 95 * Removes all registered TypeMappings and encodingStyleURIs 96 * from this TypeMappingRegistry. 97 */ 98 public void clear(); 99 }