Record Class Processor.PropertyKey

java.lang.Object
java.lang.Record
aQute.bnd.osgi.Processor.PropertyKey
All Implemented Interfaces:
Comparable<Processor.PropertyKey>
Enclosing class:
Processor

public static record Processor.PropertyKey(Processor processor, String key, int floor) extends Record implements Comparable<Processor.PropertyKey>
A Property Key is the pair of a Processor and a key it defines. It also defines if this is the firsts definition viewed from this Processor. The floor indicates where the property is defined relative to its parents. Zero is in the current processor, 1, is its parents, and so on.
  • Constructor Details

    • PropertyKey

      public PropertyKey(Processor processor, String key, int floor)
      Creates an instance of a PropertyKey record class.
      Parameters:
      processor - the value for the processor record component
      key - the value for the key record component
      floor - the value for the floor record component
  • Method Details

    • isLocalTo

      public boolean isLocalTo(Processor p)
      Check if this PropertyKey belongs to the given processor
      Parameters:
      p - the processor to check
      Returns:
      true if our processor is the same as p
    • getValue

      public String getValue()
      Get the value of the property key
      Returns:
      a processed value
    • getProvenance

      public Optional<String> getProvenance()
      Return the provenance of this key. This is generally the absolute path to the source file but can be a logical name as well.
    • getRawValue

      public String getRawValue()
      Get the raw value of the property key
      Returns:
      a raw value
    • compareTo

      public int compareTo(Processor.PropertyKey o)
      Specified by:
      compareTo in interface Comparable<Processor.PropertyKey>
    • findVisible

      public static List<Processor.PropertyKey> findVisible(Collection<Processor.PropertyKey> keys)
      Find visible property keys. "Visible" in this context means that among the PropertyKey objects with the same key, only the one with the lowest floor number is included in the result.
      Parameters:
      keys -
      Returns:
      only unique keys which are visible (lowest floor value)
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • processor

      public Processor processor()
      Returns the value of the processor record component.
      Returns:
      the value of the processor record component
    • key

      public String key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • floor

      public int floor()
      Returns the value of the floor record component.
      Returns:
      the value of the floor record component