Enum Type
- java.lang.Object
-
- java.lang.Enum<Type>
-
- io.openems.backend.timedata.timescaledb.internal.Type
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String[]
aggregateFunctions
java.lang.String
defaultAggregateFunction
int
id
java.lang.String
sqlDataType
-
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 theType
of aJsonElement
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 theType
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 aResultSet
toJsonElement
.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.
-
-
-
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 namejava.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
- thePoint
holding data- Returns:
- a
Consumer
as required bySimpleRowWriter.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 aResultSet
toJsonElement
.- Parameters:
rs
- theResultSet
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 subtractionsubtrahend
- the subtrahend of the subtraction- Returns:
- the result, possibly null
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
fromId
public static Type fromId(int id)
Gets theType
from its ID.- Parameters:
id
- the ID- Returns:
- the Type; null if unknown
-
-