Enum Type

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Type>

    public enum Type
    extends java.lang.Enum<Type>
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      FLOAT  
      INTEGER  
      STRING  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Type detect​(com.google.gson.JsonElement value)
      Tries to detect the Type of a JsonElement value.
      java.util.function.Consumer<de.bytefish.pgbulkinsert.row.SimpleRow> fillRow​(Point point)
      Fills a PgBulkInsert Row-Writer with data (timestamp, channel_id and value).
      static Type fromId​(int id)
      Gets the Type from its ID.
      java.lang.String getAggregate5mTableName​(Priority priority)
      Gets the aggregate table name of the current type and the specified priority.
      java.lang.String getRawTableName​(Priority priority)
      Gets the raw table name of the type and the specified priority.
      com.google.gson.JsonElement parseValueFromResultSet​(java.sql.ResultSet rs, int columnIndex)
      Parses a value from a ResultSet to JsonElement.
      com.google.gson.JsonElement subtract​(com.google.gson.JsonElement minuend, com.google.gson.JsonElement subtrahend)
      Subtracts two values.
      static Type valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static Type[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • INTEGER

        public static final Type INTEGER
      • FLOAT

        public static final Type FLOAT
      • STRING

        public static final Type STRING
    • Field Detail

      • id

        public final int id
      • sqlDataType

        public final java.lang.String sqlDataType
      • defaultAggregateFunction

        public final java.lang.String defaultAggregateFunction
      • aggregateFunctions

        public final java.lang.String[] aggregateFunctions
    • Method Detail

      • values

        public static Type[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Type c : Type.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Type valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getRawTableName

        public java.lang.String getRawTableName​(Priority priority)
        Gets the raw table name of the type and the specified priority.
        Parameters:
        priority - the priority of the table
        Returns:
        the table name
      • getAggregate5mTableName

        public java.lang.String getAggregate5mTableName​(Priority priority)
        Gets the aggregate table name of the current type and the specified priority.
        Parameters:
        priority - the priority of the table
        Returns:
        the table name
      • fillRow

        public java.util.function.Consumer<de.bytefish.pgbulkinsert.row.SimpleRow> fillRow​(Point point)
        Fills a PgBulkInsert Row-Writer with data (timestamp, channel_id and value).
        Parameters:
        point - the Point holding data
        Returns:
        a Consumer as required by SimpleRowWriter.startRow(Consumer)
        Throws:
        java.lang.Exception - on error
      • parseValueFromResultSet

        public com.google.gson.JsonElement parseValueFromResultSet​(java.sql.ResultSet rs,
                                                                   int columnIndex)
                                                            throws java.sql.SQLException
        Parses a value from a ResultSet to JsonElement.
        Parameters:
        rs - the ResultSet
        columnIndex - the first column is 1, the second is 2, ...
        Returns:
        a JsonElement
        Throws:
        java.sql.SQLException - on error
      • subtract

        public com.google.gson.JsonElement subtract​(com.google.gson.JsonElement minuend,
                                                    com.google.gson.JsonElement subtrahend)
                                             throws OpenemsError.OpenemsNamedException
        Subtracts two values.
        Parameters:
        minuend - the minuend of the subtraction
        subtrahend - the subtrahend of the subtraction
        Returns:
        the result, possibly null
        Throws:
        OpenemsError.OpenemsNamedException - on error
      • fromId

        public static Type fromId​(int id)
        Gets the Type from its ID.
        Parameters:
        id - the ID
        Returns:
        the Type; null if unknown
      • detect

        public static Type detect​(com.google.gson.JsonElement value)
        Tries to detect the Type of a JsonElement value.
        Parameters:
        value - the value
        Returns:
        the type