Class Data


  • public class Data
    extends Object
    Class provides simple tool to store data in different data types. To give users freedom in designing Devices and DataFeeds library offers Data structure to save and safety manipulate with generated data.
    • Constructor Detail

      • Data

        public Data​(Class<?> dataClazz,
                    Object data)
        Constructor
        Parameters:
        dataClazz - class of stored object
        data - stored data
      • Data

        public Data​(Class<?> dataClazz)
        Constructor
        Parameters:
        dataClazz - class of data stored in object
    • Method Detail

      • get

        public <T> T get​(Class<T> clazz)
        Gets data saved within Data instance with desired type. If their type is not castable to provided Class, method throws IllegalCastException.
        Type Parameters:
        T - type of class to be used
        Parameters:
        clazz - class used to retype the object to
        Returns:
        retyped stored value to new class
      • set

        public <T> T set​(T obj,
                         Class<T> clazz)
        Setter
        Type Parameters:
        T - type of class
        Parameters:
        obj - object to be set
        clazz - class of object to be set
        Returns:
        retyped object, which was set to target class