Class StringCodec.Object2String<T>

  • Type Parameters:
    T - Type of the object which is converted to/from String
    All Implemented Interfaces:
    StringCodec<T>, java.io.Serializable
    Enclosing interface:
    StringCodec<T>

    public static class StringCodec.Object2String<T>
    extends java.lang.Object
    implements StringCodec<T>, java.io.Serializable
    The attributes which represent arbitrary objects for which the schema cannot be standardized, we allow them to be represented as <ClassName>:<Constructor_String>:<Property_String> representation. This allows us to instantiate the class by invoking its constructor which takes <String> as argument. If only the <ClassName> is specified, then just the class is instantiated using default constructor. If colon is specified then class is instantiated using constructor with string as an argument. If properties are specified then properties will be set on the object. The properties are defined in property=value format separated by colon(:)
    See Also:
    Serialized Form
    • Field Detail

      • separator

        public final java.lang.String separator
    • Constructor Detail

      • Object2String

        public Object2String()
      • Object2String

        public Object2String​(java.lang.String separator)
    • Method Detail

      • loadClass

        public static java.lang.Class<?> loadClass​(java.lang.String classname,
                                                   java.lang.ClassLoader... loaders)
                                            throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException
      • fromString

        public T fromString​(java.lang.String string)
        Description copied from interface: StringCodec
        Given a string representation (typically from properties file) for an object , create object from it.
        Specified by:
        fromString in interface StringCodec<T>
        Parameters:
        string - Type of the POJO which is created from String representation.
        Returns:
        POJO obtained as a result of deserialization
      • toString

        public java.lang.String toString​(T pojo)
        Description copied from interface: StringCodec
        Given a POJO, serialize it to a String object (typically to be stored in properties file).
        Specified by:
        toString in interface StringCodec<T>
        Parameters:
        pojo - The object which needs to be serialized.
        Returns:
        Serialized representation of pojo..