org.fudgemsg.types
Class StringFieldTypeConverter

java.lang.Object
  extended by org.fudgemsg.types.StringFieldTypeConverter
All Implemented Interfaces:
FudgeTypeConverter<Object,String>

public class StringFieldTypeConverter
extends Object
implements FudgeTypeConverter<Object,String>

Converts any object values to a string using the object's toString method.


Field Summary
static StringFieldTypeConverter INSTANCE
          Singleton instance of the converter.
 
Method Summary
 boolean canConvertPrimary(Class<? extends Object> clazz)
          Always returns true.
 String primaryToSecondary(Object object)
          Returns toString called on the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static StringFieldTypeConverter INSTANCE
Singleton instance of the converter.

Method Detail

canConvertPrimary

public boolean canConvertPrimary(Class<? extends Object> clazz)
Always returns true. Any object has a toString method.

Specified by:
canConvertPrimary in interface FudgeTypeConverter<Object,String>
Parameters:
clazz - to query
Returns:
true if a call to FudgeTypeConverter.primaryToSecondary(Primary) will succeed, false if it would fail

primaryToSecondary

public String primaryToSecondary(Object object)
Returns toString called on the object.

Specified by:
primaryToSecondary in interface FudgeTypeConverter<Object,String>
Parameters:
object - to convert
Returns:
the converted object


Copyright 2009-Present by OpenGamma Inc. and individual contributors
Released under the Apache License, Version 2.0