Record Class XmlDeclaration

java.lang.Object
java.lang.Record
net.luis.utils.io.data.xml.XmlDeclaration
Record Components:
version - The version of the xml document
encoding - The encoding of the xml document
standalone - Whether the xml document is standalone or not

public record XmlDeclaration(@NotNull Version version, @NotNull Charset encoding, boolean standalone) extends Record
Represents an xml declaration.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final @NotNull Charset
    The field for the encoding record component.
    private final boolean
    The field for the standalone record component.
    private final @NotNull Version
    The field for the version record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    XmlDeclaration(@NotNull Version version)
    Constructs a new xml declaration with the given version and encoding.
    The encoding and standalone flag are set to UTF-8 and false respectively.
    XmlDeclaration(@NotNull Version version, @NotNull Charset encoding)
    Constructs a new xml declaration with the given version and encoding.
    The standalone flag is set to false.
    XmlDeclaration(@NotNull Version version, @NotNull Charset encoding, boolean standalone)
    Constructs a new xml declaration with the given version, encoding and standalone flag.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Charset
    Returns the value of the encoding record component.
    boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns a hash code value for this object.
    boolean
    Returns the value of the standalone record component.
    Returns a string representation of this record class.
    @NotNull Version
    Returns the value of the version record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • version

      @NotNull private final @NotNull Version version
      The field for the version record component.
    • encoding

      @NotNull private final @NotNull Charset encoding
      The field for the encoding record component.
    • standalone

      private final boolean standalone
      The field for the standalone record component.
  • Constructor Details

    • XmlDeclaration

      public XmlDeclaration(@NotNull @NotNull Version version, @NotNull @NotNull Charset encoding, boolean standalone)
      Constructs a new xml declaration with the given version, encoding and standalone flag.
      Parameters:
      version - The version of the xml document
      encoding - The encoding of the xml document
      standalone - Whether the xml document is standalone or not
      Throws:
      NullPointerException - If the version or encoding is null
      IllegalArgumentException - If the version is invalid
    • XmlDeclaration

      public XmlDeclaration(@NotNull @NotNull Version version)
      Constructs a new xml declaration with the given version and encoding.
      The encoding and standalone flag are set to UTF-8 and false respectively.
      Parameters:
      version - The version of the xml document
      Throws:
      NullPointerException - If the version is null
      IllegalArgumentException - If the version is invalid
    • XmlDeclaration

      public XmlDeclaration(@NotNull @NotNull Version version, @NotNull @NotNull Charset encoding)
      Constructs a new xml declaration with the given version and encoding.
      The standalone flag is set to false.
      Parameters:
      version - The version of the xml document
      encoding - The encoding of the xml document
      Throws:
      NullPointerException - If the version or encoding is null
      IllegalArgumentException - If the version is invalid
  • Method Details

    • equals

      public 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • hashCode

      public 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
    • 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
    • version

      @NotNull public @NotNull Version version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • encoding

      @NotNull public @NotNull Charset encoding()
      Returns the value of the encoding record component.
      Returns:
      the value of the encoding record component
    • standalone

      public boolean standalone()
      Returns the value of the standalone record component.
      Returns:
      the value of the standalone record component