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.booleanDetermines if a matching license has been detected.Gets the charset for the document.Gets the document type.org.apache.tika.mime.MediaTypeGets the defined media type.booleanReturnstrueifsetCharset(java.nio.charset.Charset)has been called.booleanisApproved(ILicense license)Determine if the license is an approved license.booleanReturntrueif the directory flag was set.licenses()Gets the stream of licenses that have been matched.voidremoveLicenses(Predicate<ILicense> filter)Remove matched licenses based on a predicate.voidreportOnLicense(ILicense license)Add the license information to the metadata.voidsetApprovalPredicate(Predicate<ILicense> approvalPredicate)Sets the set of approved licenses.voidsetCharset(Charset charset)Sets the charset for the document.voidsetDocumentType(Document.Type type)Sets the document type.voidsetIsDirectory(boolean state)Set the directory flag.voidsetMediaType(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 tonullthe system default charset will be used.- Parameters:
charset- the charset to use.
-
hasCharset
public boolean hasCharset()ReturnstrueifsetCharset(java.nio.charset.Charset)has been called.- Returns:
trueifsetCharset(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:
trueif the license is in the list of approved licenses,falseotherwise.
-
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()Returntrueif 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
-