Class MetaData

java.lang.Object
org.apache.rat.api.MetaData

public class MetaData extends Object
Data about the document under test.
  • Constructor Details

    • MetaData

      public MetaData()
      Create metadata without a content type.
  • Method Details

    • getCharset

      public Charset getCharset()
      Gets the charset for the document. If the charset was not set will return the system default charset.
      Returns:
      the charset for the document
    • setCharset

      public void setCharset(Charset charset)
      Sets the charset for the document. If set to null the system default charset will be used.
      Parameters:
      charset - the charset to use.
    • hasCharset

      public boolean hasCharset()
      Returns true if setCharset(java.nio.charset.Charset) has been called.
      Returns:
      true if setCharset(java.nio.charset.Charset) has been called.
    • getMediaType

      public org.apache.tika.mime.MediaType getMediaType()
      Gets the defined media type.
      Returns:
      the media type.
    • setMediaType

      public void setMediaType(org.apache.tika.mime.MediaType mediaType)
      Sets the defined media type.
      Parameters:
      mediaType - the media type.
    • detectedLicense

      public boolean detectedLicense()
      Determines if a matching license has been detected.
      Returns:
      true if there is a matching license.
    • setApprovalPredicate

      public void setApprovalPredicate(Predicate<ILicense> approvalPredicate)
      Sets the set of approved licenses.
      Parameters:
      approvalPredicate - the predicate to validate licenses.
    • licenses

      public Stream<ILicense> licenses()
      Gets the stream of licenses that have been matched.
      Returns:
      the stream of licenses that have been matched.
    • approvedLicenses

      public Stream<ILicense> approvedLicenses()
      Gets the stream of approved licenses that have been matched.
      Returns:
      the stream of approved licenses that have been matched.
    • isApproved

      public boolean isApproved(ILicense license)
      Determine if the license is an approved license.
      Parameters:
      license - the license to check.
      Returns:
      true if the license is in the list of approved licenses, false otherwise.
    • unapprovedLicenses

      public Stream<ILicense> unapprovedLicenses()
      Gets the stream of unapproved licenses that have been matched.
      Returns:
      the stream of unapproved licenses that have been matched.
    • setDocumentType

      public void setDocumentType(Document.Type type)
      Sets the document type.
      Parameters:
      type - the document type for the document being recorded.
    • setIsDirectory

      public void setIsDirectory(boolean state)
      Set the directory flag.
      Parameters:
      state - the state to set the directory flag in.
    • isDirectory

      public boolean isDirectory()
      Return true if the directory flag was set.
      Returns:
      the directory flag.
    • getDocumentType

      public Document.Type getDocumentType()
      Gets the document type.
      Returns:
      the document type of the document that was recorded.
    • reportOnLicense

      public void reportOnLicense(ILicense license)
      Add the license information to the metadata.
      Parameters:
      license - the license to add metadata for.
    • removeLicenses

      public void removeLicenses(Predicate<ILicense> filter)
      Remove matched licenses based on a predicate. Will remove licenses for which the predicate returns true.
      Parameters:
      filter - the predicate to use.
    • toString

      public String toString()
      Overrides:
      toString in class Object