java.lang.Object
java.lang.Record
org.matwoess.jsourceprofiler.tool.model.Metadata
Record Components:
blocksCount - the total number of blocks found in the project
javaFiles - the list of java files in the project

public record Metadata(int blocksCount, JavaFile[] javaFiles) extends Record
Helper class to represent the metadata of a java project.

Contains the total number of blocks and the list of java files and their respective JavaFile objects.

Includes methods to export and import the metadata to/from a file.

  • Constructor Details

    • Metadata

      public Metadata(int blocksCount, JavaFile[] javaFiles)
      Creates an instance of a Metadata record class.
      Parameters:
      blocksCount - the value for the blocksCount record component
      javaFiles - the value for the javaFiles record component
  • Method Details

    • exportMetadata

      public void exportMetadata(Path metadataPath)
      Exports the metadata to the filesystem.

      The metadata file is located at IO.getMetadataPath().

      Parameters:
      metadataPath - the path to the metadata file
    • importMetadata

      public static Metadata importMetadata(Path metadataPath)
      Imports the metadata from the filesystem.

      The metadata file is located at IO.getMetadataPath().

      Parameters:
      metadataPath - the path to the metadata file
      Returns:
      a new Metadata object read from a file
    • 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.
    • blocksCount

      public int blocksCount()
      Returns the value of the blocksCount record component.
      Returns:
      the value of the blocksCount record component
    • javaFiles

      public JavaFile[] javaFiles()
      Returns the value of the javaFiles record component.
      Returns:
      the value of the javaFiles record component