Class JarMetadata

java.lang.Object
uno.anahata.asi.toolkit.java.classpath.JarMetadata

public class JarMetadata extends Object
Represents the extracted metadata of a JAR file.

This DTO is used by the VeryPrettyClassPathPrinter to represent libraries in a token-efficient manner.

Author:
anahata
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    The logical ID of the JAR (usually the artifactId).
    private Map<String,String>
    Additional properties discovered during inspection.
    private String
    The vendor or provider of the library (e.g., "Apache NetBeans", "Google").
    private String
    The version of the library, recovered from the filename, Manifest, or Maven properties.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Determines if this metadata is "better" than another (more informative).
    static String
    Sanitizes a version string by removing build metadata, timestamps, and trailing spaces.
    Converts the metadata into a TOON (Token Optimized Object Notation) string.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • id

      private String id
      The logical ID of the JAR (usually the artifactId).
    • version

      private String version
      The version of the library, recovered from the filename, Manifest, or Maven properties.
    • vendor

      private String vendor
      The vendor or provider of the library (e.g., "Apache NetBeans", "Google").
    • properties

      private Map<String,String> properties
      Additional properties discovered during inspection.
  • Constructor Details

    • JarMetadata

      public JarMetadata()
  • Method Details

    • sanitizeVersion

      public static String sanitizeVersion(String version)
      Sanitizes a version string by removing build metadata, timestamps, and trailing spaces.

      For example: "3.6.2 1423725 - rmuir - 2012-12-18" becomes "3.6.2".

      Parameters:
      version - The raw version string.
      Returns:
      The sanitized version string.
    • isBetterThan

      public boolean isBetterThan(JarMetadata other)
      Determines if this metadata is "better" than another (more informative).
      Parameters:
      other - The other metadata to compare with.
      Returns:
      true if this is more informative.
    • toToon

      public String toToon()
      Converts the metadata into a TOON (Token Optimized Object Notation) string.
      Returns:
      A compact string representation.