src/main/java/org/eiichiro/bootleg/json/ValueTypeJsonSerializer.java
public JsonElement serialize(T src, Type typeOfSrc,
			JsonSerializationContext context) {
		Class<?> type = Types.getRawType(typeOfSrc);
		Converter converter = ConvertUtils.lookup(type);
		
		if ((converter != null && converter instanceof AbstractConverter)) {
			String string = (String) ConvertUtils.convert(src, String.class);
			
			if (string != null) {
				return new JsonPrimitive(string);
			}
		}
		
		return new JsonPrimitive(src.toString());
	}
public JsonElement serialize(T src, Type typeOfSrc,
			JsonSerializationContext context) {
		Class<?> type = Types.getRawType(typeOfSrc);
		Converter converter = ConvertUtils.lookup(type);
		
		if ((converter != null && converter instanceof AbstractConverter)) {
			String string = (String) ConvertUtils.convert(src, String.class);
			
			if (string != null) {
				return new JsonPrimitive(string);
			}
		}
		
		return new JsonPrimitive(src.toString());
	}
public JsonElement serialize ( T src , Type typeOfSrc , JsonSerializationContext context ) { Class < ? > type = Types . getRawType ( typeOfSrc ) ; Converter converter = ConvertUtils . lookup ( type ) ; if ( ( converter != null && converter instanceof AbstractConverter ) ) { String string = ( String ) ConvertUtils . convert ( src , String . class ) ; if ( string != null ) { return new JsonPrimitive ( string ) ; } } return new JsonPrimitive ( src . toString ( ) ) ; }
Serializes the specified user-defined value type object to
<code>JsonPrimitive</code> representation.
Serializes the specified user - defined value type object to <code > JsonPrimitive< / code > representation .