Class TimePeriodImpl

    • Constructor Detail

      • TimePeriodImpl

        public TimePeriodImpl​(IdGroupingToken groupId,
                              long startTimeSeconds,
                              long durationSeconds)
        Constructor
        Parameters:
        groupId - contiguous id generation within this group for instances of this class
        startTimeSeconds - start time in seconds from midnight
        durationSeconds - duration in seconds
      • TimePeriodImpl

        public TimePeriodImpl​(IdGroupingToken groupId,
                              String description,
                              long startTimeSeconds,
                              long durationSeconds)
        Constructor
        Parameters:
        groupId - contiguous id generation within this group for instances of this class
        description - description of this time period
        startTimeSeconds - start time of this time period
        durationSeconds - duration of this time period
      • TimePeriodImpl

        public TimePeriodImpl​(TimePeriodImpl timePeriodImpl,
                              boolean deepCopy)
        Copy constructor
        Parameters:
        timePeriodImpl - to copy
        deepCopy - when true, create a deep copy, shallow copy otherwise
    • Method Detail

      • generateId

        protected static long generateId​(IdGroupingToken tokenId)
        Generate id for instances of this class based on the token and class identifier
        Parameters:
        tokenId - to use
        Returns:
        generated id
      • getStartTimeSeconds

        public long getStartTimeSeconds()
        Return the start time
        Specified by:
        getStartTimeSeconds in interface TimePeriod
        Returns:
        start time
      • getDurationSeconds

        public long getDurationSeconds()
        Return the duration in seconds
        Specified by:
        getDurationSeconds in interface TimePeriod
        Returns:
        duration
      • getDescription

        public String getDescription()
        Return the description
        Specified by:
        getDescription in interface TimePeriod
        Returns:
        description of this TimePeriod
      • recreateManagedIds

        public long recreateManagedIds​(IdGroupingToken tokenId)
        recreate the internal id(s) and set them including the Idable id
        Specified by:
        recreateManagedIds in interface ManagedId
        Parameters:
        tokenId - to use (may be null in case managed id entity does not rely on token to recreate its managed id(s))
        Returns:
        the updated internal id
      • deepClone

        public TimePeriodImpl deepClone()
        An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call. To be used with caution if not called by managed id container related code
        Specified by:
        deepClone in interface IdAble
        Specified by:
        deepClone in interface TimePeriod
        Overrides:
        deepClone in class ExternalIdAbleImpl
        Returns:
        deep copy of entity
      • toString

        public String toString()
        Output this object as a String
        Overrides:
        toString in class Object
        Returns:
        String containing the value of this TimePeriod