Record Class EntryReader.Entry

java.lang.Object
java.lang.Record
org.plumelib.util.EntryReader.Entry
Record Components:
firstLine - first line of the entry
body - complete body of the entry including the first line
filename - filename in which the entry was found
lineNumber - line number of first line of entry
shortEntry - true if this is a short entry (blank-line-separated)
Enclosing class:
EntryReader

public static record EntryReader.Entry(String firstLine, String body, String filename, long lineNumber, boolean shortEntry) extends Record
Descriptor for an entry (record, paragraph, etc.).
  • Constructor Details

    • Entry

      public Entry(String firstLine, String body, String filename, long lineNumber, boolean shortEntry)
      Creates an instance of a Entry record class.
      Parameters:
      firstLine - the value for the firstLine record component
      body - the value for the body record component
      filename - the value for the filename record component
      lineNumber - the value for the lineNumber record component
      shortEntry - the value for the shortEntry record component
  • Method Details

    • getDescription

      public String getDescription(@Nullable Pattern re)
      Returns a substring of the entry body that matches the specified regular expression. If no match is found, returns firstLine.
      Parameters:
      re - regex to match
      Returns:
      a substring that matches re
    • toString

      public final 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
    • 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. 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.
    • firstLine

      public String firstLine()
      Returns the value of the firstLine record component.
      Returns:
      the value of the firstLine record component
    • body

      public String body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component
    • filename

      public String filename()
      Returns the value of the filename record component.
      Returns:
      the value of the filename record component
    • lineNumber

      public long lineNumber()
      Returns the value of the lineNumber record component.
      Returns:
      the value of the lineNumber record component
    • shortEntry

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