Package entsoe

Record Class EntsoeDate

Record Components:
utcDate - the utc date
All Implemented Interfaces:
Comparable<EntsoeDate>

public record EntsoeDate(ZonedDateTime utcDate) extends Record implements Comparable<EntsoeDate>
Helper record to handle the special date format used in the ENTSO-E API. The record is comparable/sortable. It supports equals() and can thus be used without restriction as a key attribute in all Java Collection classes.
  • Field Details

    • UTC_ZONE

      public static final ZoneId UTC_ZONE
      The default ZoneId
  • Constructor Details

    • EntsoeDate

      public EntsoeDate(ZonedDateTime utcDate)
      Creates a new object based on the provided utc time.
      Parameters:
      utcDate - the utc time
  • Method Details

    • fromENTSOEDate

      public static EntsoeDate fromENTSOEDate(EntsoeDate entsoeDate, int position, EntsoeResolution entsoeResolution)
      Constrict an new object based on an existing object and a relative offset (position).
      Parameters:
      entsoeDate - The base date
      position - the relative position to the date compared
      entsoeResolution - the resolution to use. EntsoeResolution.PT60M supports only full hours, EntsoeResolution.PT15M supports 15-minute intervals
      Returns:
      the new date
    • fromENTSOEDateString

      public static EntsoeDate fromENTSOEDateString(String entsoeFormat)
      Create a new object of the String representation of an ENTSO-E date.
      Parameters:
      entsoeFormat - A date like 202301010123 what means Jan 1st, 2023 at 1:23am
      Returns:
      new object
    • getEntsoeDate

      public String getEntsoeDate()
      Date-only ENTSO-E String representation of the utc date object
      Returns:
      Date-only ENTSO-E String representation of the utc date object
    • getEntsoeDateTime

      public String getEntsoeDateTime()
      Date-time ENTSO-E String representation of the utc date object
      Returns:
      Date-time ENTSO-E String representation of the utc date object
    • toPrettyLocalString

      public String toPrettyLocalString()
    • toPrettyUTCString

      public String toPrettyUTCString()
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • compareTo

      public int compareTo(EntsoeDate o)
      Specified by:
      compareTo in interface Comparable<EntsoeDate>
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • utcDate

      public ZonedDateTime utcDate()
      Returns the value of the utcDate record component.
      Returns:
      the value of the utcDate record component