Package alluxio.util

Interface JsonSerializable


  • public interface JsonSerializable
    This represents stress test objects that can be ser/de to/from json.
    • Field Detail

      • CLASS_NAME_FIELD

        static final java.lang.String CLASS_NAME_FIELD
        This must match the java field for the class name.
        See Also:
        Constant Field Values
    • Method Detail

      • getClassName

        default java.lang.String getClassName()
        Returns:
        the name of the class
      • setClassName

        default void setClassName​(java.lang.String className)
        Parameters:
        className - the name of the class
      • toJson

        default java.lang.String toJson()
                                 throws com.fasterxml.jackson.core.JsonProcessingException
        Returns:
        the json string representation
        Throws:
        com.fasterxml.jackson.core.JsonProcessingException
      • fromJson

        static JsonSerializable fromJson​(java.lang.String json)
                                  throws java.io.IOException,
                                         java.lang.ClassNotFoundException
        Parameters:
        json - the json string representation
        Returns:
        the parsed object
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • fromJson

        static <T extends JsonSerializable> T fromJson​(java.lang.String json,
                                                       T[] types)
                                                throws java.io.IOException,
                                                       java.lang.ClassNotFoundException
        Type Parameters:
        T - the type to return
        Parameters:
        json - the json string representation
        types - the array types to cast the resulting object
        Returns:
        the parsed object
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException