Package org.daiitech.naftah.builtin.time
Record Class NaftahTime.ZoneOrOffset
java.lang.Object
java.lang.Record
org.daiitech.naftah.builtin.time.NaftahTime.ZoneOrOffset
- Record Components:
arabicZoneOrOffset- the Arabic zone name or offset stringoffset- true if the value is a numeric offset, false if a named zonezoneId- the resolvedZoneIdrepresentation
- Enclosing class:
- NaftahTime
public static record NaftahTime.ZoneOrOffset(String arabicZoneOrOffset, boolean offset, ZoneId zoneId)
extends Record
Represents an Arabic time zone or numeric offset.
Stores the original Arabic zone or offset string, a boolean indicating
whether it is a numeric offset, and the resolved ZoneId.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringThe field for thearabicZoneOrOffsetrecord component.private final booleanThe field for theoffsetrecord component.private final ZoneIdThe field for thezoneIdrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionZoneOrOffset(String arabicZoneOrOffset, boolean offset, ZoneId zoneId) Creates an instance of aZoneOrOffsetrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thearabicZoneOrOffsetrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanoffset()Returns the value of theoffsetrecord component.static NaftahTime.ZoneOrOffsetCreates aZoneOrOffsetinstance representing a numeric offset.static NaftahTime.ZoneOrOffsetCreates aZoneOrOffsetinstance representing a named time zone.private static ZoneIdtoString()Returns a string representation of thisZoneOrOffset.zoneId()Returns the value of thezoneIdrecord component.
-
Field Details
-
arabicZoneOrOffset
The field for thearabicZoneOrOffsetrecord component. -
offset
private final boolean offsetThe field for theoffsetrecord component. -
zoneId
The field for thezoneIdrecord component.
-
-
Constructor Details
-
ZoneOrOffset
Creates an instance of aZoneOrOffsetrecord class.- Parameters:
arabicZoneOrOffset- the value for thearabicZoneOrOffsetrecord componentoffset- the value for theoffsetrecord componentzoneId- the value for thezoneIdrecord component
-
-
Method Details
-
parseZone
-
ofZone
Creates aZoneOrOffsetinstance representing a named time zone.- Parameters:
arabicZone- the Arabic name of the time zone- Returns:
- a new
ZoneOrOffsetinstance
-
ofOffset
Creates aZoneOrOffsetinstance representing a numeric offset.- Parameters:
offset- the offset string (e.g., "+02:00")- Returns:
- a new
ZoneOrOffsetinstance
-
toString
Returns a string representation of thisZoneOrOffset.- If it represents an offset, returns the offset string directly.
- If it represents a named time zone, returns "بتوقيت <zoneName>"
- If the zone name is empty, returns an empty string.
-
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. -
equals
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
arabicZoneOrOffset
Returns the value of thearabicZoneOrOffsetrecord component.- Returns:
- the value of the
arabicZoneOrOffsetrecord component
-
offset
public boolean offset()Returns the value of theoffsetrecord component.- Returns:
- the value of the
offsetrecord component
-
zoneId
Returns the value of thezoneIdrecord component.- Returns:
- the value of the
zoneIdrecord component
-