Class LibraryIdentifier

java.lang.Object
i5.las2peer.classLoaders.libraries.LibraryIdentifier

public class LibraryIdentifier extends Object
a basic class managing a library identifier of the format name-number where number fits the format of LibraryVersion
  • Field Details

  • Constructor Details

    • LibraryIdentifier

      public LibraryIdentifier(String name) throws IllegalArgumentException
      generate a new LibraryIdentifier from its string representation
      Parameters:
      name - A canonical library name
      Throws:
      IllegalArgumentException - If the version information is not correctly formatted
    • LibraryIdentifier

      public LibraryIdentifier(String name, String version) throws IllegalArgumentException
      generate a new identifier
      Parameters:
      name - A canonical library name
      version - A library version
      Throws:
      IllegalArgumentException - If the version information is not correctly formatted
    • LibraryIdentifier

      public LibraryIdentifier(String name, LibraryVersion version)
      generate a new library identifier
      Parameters:
      name - A canonical library name
      version - A library version
  • Method Details

    • fromFilename

      public static LibraryIdentifier fromFilename(String filename)
    • getVersion

      public LibraryVersion getVersion()
      Returns:
      version of this library
    • getName

      public String getName()
      Returns:
      name of the library
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      a string representation of this identifier
    • equals

      public boolean equals(LibraryIdentifier i)
      compares this identifier to another one
      Parameters:
      i - A library identifier
      Returns:
      true, if the given identifier is the same as this
    • equals

      public boolean equals(Object o)
      compares this identifier against other objects if a string is given, the string representation of this identifier is compared to the given string
      Overrides:
      equals in class Object
      Parameters:
      o - Another object to compare to
      Returns:
      true, if the given object is an identifier and is the same as this
    • hashCode

      public int hashCode()
      since equals is overridden, we should implement an own hashCode.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code