Package org.apache.rat.api
Class MetaData
java.lang.Object
org.apache.rat.api.MetaData
Data about the document under test.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the stream of approved licenses that have been matched.boolean
Determines if a matching license has been detected.Gets the charset for the document.Gets the document type.org.apache.tika.mime.MediaType
Gets the defined media type.boolean
Returnstrue
ifsetCharset(java.nio.charset.Charset)
has been called.boolean
isApproved
(ILicense license) Determine if the license is an approved license.boolean
Returntrue
if the directory flag was set.licenses()
Gets the stream of licenses that have been matched.void
removeLicenses
(Predicate<ILicense> filter) Remove matched licenses based on a predicate.void
reportOnLicense
(ILicense license) Add the license information to the metadata.void
setApprovalPredicate
(Predicate<ILicense> approvalPredicate) Sets the set of approved licenses.void
setCharset
(Charset charset) Sets the charset for the document.void
setDocumentType
(Document.Type type) Sets the document type.void
setIsDirectory
(boolean state) Set the directory flag.void
setMediaType
(org.apache.tika.mime.MediaType mediaType) Sets the defined media type.toString()
Gets the stream of unapproved licenses that have been matched.
-
Constructor Details
-
MetaData
public MetaData()Create metadata without a content type.
-
-
Method Details
-
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
Sets the charset for the document. If set tonull
the system default charset will be used.- Parameters:
charset
- the charset to use.
-
hasCharset
public boolean hasCharset()Returnstrue
ifsetCharset(java.nio.charset.Charset)
has been called.- Returns:
true
ifsetCharset(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
Sets the set of approved licenses.- Parameters:
approvalPredicate
- the predicate to validate licenses.
-
licenses
Gets the stream of licenses that have been matched.- Returns:
- the stream of licenses that have been matched.
-
approvedLicenses
Gets the stream of approved licenses that have been matched.- Returns:
- the stream of approved licenses that have been matched.
-
isApproved
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
Gets the stream of unapproved licenses that have been matched.- Returns:
- the stream of unapproved licenses that have been matched.
-
setDocumentType
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()Returntrue
if the directory flag was set.- Returns:
- the directory flag.
-
getDocumentType
Gets the document type.- Returns:
- the document type of the document that was recorded.
-
reportOnLicense
Add the license information to the metadata.- Parameters:
license
- the license to add metadata for.
-
removeLicenses
Remove matched licenses based on a predicate. Will remove licenses for which the predicate returns true.- Parameters:
filter
- the predicate to use.
-
toString
-