Class Resource

java.lang.Object
org.apache.creadur.whisker.model.Resource
All Implemented Interfaces:
Comparable<Resource>, ContentElement

public class Resource extends Object implements Comparable<Resource>, ContentElement
A resource expected in a software distribution.
  • Constructor Details

    • Resource

      public Resource(String name, String noticeId, String source)
      Constructs a resource in a software distribution.
      Parameters:
      name - not null
      noticeId - identifies the notice for this resource, null when there is no NOTICE
      source - describes how source may be obtained, null when this is not needed
  • Method Details

    • getName

      public String getName()
      Gets the name for this resource expected in a software distribution.
      Returns:
      not null
    • getNoticeId

      public String getNoticeId()
      Gets an identifier for the optional NOTICE.
      Returns:
      an identifier for the NOTICE, or null when the resource has no NOTICE
    • hashCode

      public int hashCode()
      Based on name.
      Overrides:
      hashCode in class Object
      Returns:
      hash code for the name
      See Also:
    • equals

      public boolean equals(Object obj)
      Based on name.
      Overrides:
      equals in class Object
      Parameters:
      obj - possibly null
      Returns:
      equality based on name
      See Also:
    • toString

      public String toString()
      Gets a description suitable for logging.
      Overrides:
      toString in class Object
      Returns:
      a description suitable for logging
      See Also:
    • compareTo

      public int compareTo(Resource other)
      Comparison happens based on name.
      Specified by:
      compareTo in interface Comparable<Resource>
      Parameters:
      other - resource to compare to.
      Returns:
      result of comparison based on name
      See Also:
    • accept

      public void accept(Visitor visitor)
      Accepts a visitor.
      Specified by:
      accept in interface ContentElement
      Parameters:
      visitor - possibly null
    • getSource

      public String getSource()
      Gets a locator for the source.
      Returns:
      a source locator, possibly null
    • hasSource

      public boolean hasSource()
      Is this resource linked to source?
      Returns:
      true when this resource has linked source, false otherwise