package com.thoughtworks.xstream.mapper;

import com.thoughtworks.xstream.converters.SingleValueConverter;

public interface Mapper {
    /**
     * Place holder type used for null values.
     */
    class Null {}

    /**
     * How a class name should be represented in its serialized form.
     */
    String serializedClass(Class type);

    /**
     * How a serialized class representation should be mapped back to a real class.
     */
    Class realClass(String elementName);

    /**
     * How a class member should be represented in its serialized form.
     */
    String serializedMember(Class type, String memberName);

    /**
     * How a serialized member representation should be mapped back to a real member.
     */
    String realMember(Class type, String serialized);

    /**
     * Whether this type is a simple immutable value (int, boolean, String, URL, etc.
     * Immutable types will be repeatedly written in the serialized stream, instead of using object references.
     */
    boolean isImmutableValueType(Class type);

    Class defaultImplementationOf(Class type);

    /**
     * @deprecated since 1.2, use aliasForAttribute instead.
     */
    String attributeForImplementationClass();

    /**
     * @deprecated since 1.2, use aliasForAttribute instead.
     */
    String attributeForClassDefiningField();

    /**
     * @deprecated since 1.2, use aliasForAttribute instead.
     */
    String attributeForReadResolveField();

    /**
     * @deprecated since 1.2, use aliasForAttribute instead.
     */
    String attributeForEnumType();

    /**
     * Get the alias for an attrbute's name.
     * 
     * @param attribute the attribute
     * @return the alias
     * @since 1.2
     */
    String aliasForAttribute(String attribute);

    /**
     * Get the attribut's name for an alias.
     * 
     * @param alias the alias
     * @return the attribute's name
     * @since 1.2
     */
    String attributeForAlias(String alias);

    /**
     * Get the name of the field that acts as the default collection for an object, or return null if there is none.
     *
     * @param definedIn     owning type
     * @param itemType      item type
     * @param itemFieldName optional item element name
     */
    String getFieldNameForItemTypeAndName(Class definedIn, Class itemType, String itemFieldName);

    Class getItemTypeForItemFieldName(Class definedIn, String itemFieldName);

    ImplicitCollectionMapping getImplicitCollectionDefForFieldName(Class itemType, String fieldName);

    /**
     * Determine whether a specific member should be serialized.
     *
     * @since 1.1.3
     */
    boolean shouldSerializeMember(Class definedIn, String fieldName);

    interface ImplicitCollectionMapping {
        String getFieldName();
        String getItemFieldName();
        Class getItemType();
    }

    SingleValueConverter getConverterFromItemType(String fieldName, Class type);

    SingleValueConverter getConverterFromItemType(Class type);

    SingleValueConverter getConverterFromAttribute(String name);
    
    Mapper lookupMapperOfType(Class type);

    /**
     * Returns a single value converter to be used in a specific field.
     * 
     * @param fieldName	the field name
     * @param type		the field type
     * @param definedIn	the type which defines this field
     * @return	a SingleValueConverter or null if there no such converter should be used for this field.
     * @since upcoming
     */
	SingleValueConverter getConverterFromItemType(String fieldName, Class type, Class definedIn);

	/**
	 * Returns an alias for a single field defined in an specific type.
	 * 
	 * @param definedIn	the type where the field was defined
	 * @param fieldName	the field name
	 * @return	the alias for this field or its own name if no alias was defined
	 * @since upcoming
	 */
	String aliasForAttribute(Class definedIn, String fieldName);

	/**
	 * Returns the field name for an aliased attribute.
	 * @param the type
	 * @param attrAlias	the aliased attribute
	 * @return	the original attribute name
	 */
	String attributeForAlias(Class definedIn, String alias);

	/**
	 * Returns which converter to use for an specific attribute in a type.
	 */
	SingleValueConverter getConverterFromAttribute(Class type, String attribute);
}

@@ -3211,33 +3211,33 @@
 @param fieldName
-%09
+ 
 the field name%0A 
@@ -3257,10 +3257,9 @@
 type
-%09%09
+ 
 the 
@@ -3284,33 +3284,33 @@
 @param definedIn
-%09
+ 
 the type which d
@@ -3341,17 +3341,17 @@
  @return
-%09
+ 
 a Single
@@ -3419,24 +3419,39 @@
 sed for this
+%0A     *        
  field.%0A    
@@ -3473,25 +3473,28 @@
 ing%0A     */%0A
-%09
+    
 SingleValueC
@@ -3572,30 +3572,36 @@
 efinedIn);%0A%0A
-%09/**%0A%09
+    /**%0A    
  * Returns a
@@ -3660,14 +3660,20 @@
 pe.%0A
-%09 * %0A%09
+     * %0A    
  * @
@@ -3687,17 +3687,17 @@
 efinedIn
-%09
+ 
 the type
@@ -3721,25 +3721,28 @@
 was defined%0A
-%09
+    
  * @param fi
@@ -3748,17 +3748,17 @@
 ieldName
-%09
+ 
 the fiel
@@ -3764,17 +3764,20 @@
 ld name%0A
-%09
+    
  * @retu
@@ -3774,25 +3774,25 @@
    * @return
-%09
+ 
 the alias fo
@@ -3844,17 +3844,20 @@
 defined%0A
-%09
+    
  * @sinc
@@ -3867,22 +3867,28 @@
 pcoming%0A
-%09 */%0A%09
+     */%0A    
 String a
@@ -3937,30 +3937,36 @@
 ieldName);%0A%0A
-%09/**%0A%09
+    /**%0A    
  * Returns t
@@ -4009,29 +4009,81 @@
 te.%0A
-%09 * @param the type%0A%09
+     * %0A     * @param definedIn the type where the field was defined%0A    
  * @
@@ -4093,17 +4093,13 @@
 am a
-ttrA
 lias
-%09
+ 
 the 
@@ -4107,22 +4107,13 @@
 lias
-ed attribute%0A%09
+%0A    
  * @
@@ -4118,17 +4118,17 @@
  @return
-%09
+ 
 the orig
@@ -4147,22 +4147,51 @@
 te name%0A
-%09 */%0A%09
+     * @since upcoming%0A     */%0A    
 String a
@@ -4244,14 +4244,20 @@
 );%0A%0A
-%09/**%0A%09
+    /**%0A    
  * R
@@ -4327,14 +4327,128 @@
 pe.%0A
-%09 */%0A%09
+     * %0A     * @param type the field type%0A     * @param attribute the attribute name%0A     * @since upcoming%0A     */%0A    
 Sing

Fix javadoc.