src/main/java/org/eiichiro/bootleg/xml/ValueTypeXmlAdapter.java
@Override
	public String marshal(BoundType v) throws Exception {
		Class<? extends Object> type = v.getClass();
		
		if (!Types.isUserDefinedValueType(type)) {
			throw new IllegalArgumentException("Type [" + type
					+ "] must be an user-defined value type; "
					+ "@XmlJavaTypeAdapter(ValueTypeXmlAdapter.class) "
					+ "can be annotated to user-defined value type and field only");
		}
		
		Converter converter = ConvertUtils.lookup(type);
		
		if ((converter != null && converter instanceof AbstractConverter)) {
			String string = (String) ConvertUtils.convert(v, String.class);
			
			if (string != null) {
				return string;
			}
		}
		
		return v.toString();
	}
@Override
	public String marshal(BoundType v) throws Exception {
		Class<? extends Object> type = v.getClass();
		
		if (!Types.isUserDefinedValueType(type)) {
			throw new IllegalArgumentException("Type [" + type
					+ "] must be an user-defined value type; "
					+ "@XmlJavaTypeAdapter(ValueTypeXmlAdapter.class) "
					+ "can be annotated to user-defined value type and field only");
		}
		
		Converter converter = ConvertUtils.lookup(type);
		
		if ((converter != null && converter instanceof AbstractConverter)) {
			String string = (String) ConvertUtils.convert(v, String.class);
			
			if (string != null) {
				return string;
			}
		}
		
		return v.toString();
	}
@ Override public String marshal ( BoundType v ) throws Exception { Class < ? extends Object > type = v . getClass ( ) ; if ( ! Types . isUserDefinedValueType ( type ) ) { throw new IllegalArgumentException ( "Type [" + type + "] must be an user-defined value type; " + "@XmlJavaTypeAdapter(ValueTypeXmlAdapter.class) " + "can be annotated to user-defined value type and field only" ) ; } Converter converter = ConvertUtils . lookup ( type ) ; if ( ( converter != null && converter instanceof AbstractConverter ) ) { String string = ( String ) ConvertUtils . convert ( v , String . class ) ; if ( string != null ) { return string ; } } return v . toString ( ) ; }
Marshals the specified user-defined value type object to single XML value
string representation.

@throws If the specified object is not a user-defined value type.
Marshals the specified user - defined value type object to single XML value string representation .