Package org.apache.rat.document.impl
Class DocumentName
java.lang.Object
org.apache.rat.document.impl.DocumentName
- All Implemented Interfaces:
Comparable<DocumentName>
A collection of names for a document. All names in the set are
either Rat (Linux like) or native (OS specific).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean
True if the file system on which we are operating is case-sensitive -
Constructor Summary
ConstructorsConstructorDescriptionDocumentName
(File file) Creates a document name with the name and basename equal to the file nameDocumentName
(File file, DocumentName baseName) Creates a document name with the name of the file and the same basename as the baseName document.DocumentName
(String name, String baseName, String dirSeparator, boolean isCaseSensitive) Creates a Document name. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
Gets the DocumentName for the basename of this document name.Gets the fully qualified basename of the document.Returns the directory separator.getName()
Gets the fully qualified name of the document.Gets the last segment of the name.int
hashCode()
boolean
Gets the case sensitivity flag.Gets the portion of the name that is not part of the base name.Gets the portion of the name that is not part of the base name.Creates a new document name by adding the child to the current name.String[]
Tokenizes the string based on the dirSeparatortoString()
-
Field Details
-
FS_IS_CASE_SENSITIVE
public static final boolean FS_IS_CASE_SENSITIVETrue if the file system on which we are operating is case-sensitive
-
-
Constructor Details
-
DocumentName
Creates a Document name.- Parameters:
name
- the name of the documentbaseName
- the base name of the document.dirSeparator
- the directory separator used in the name.isCaseSensitive
-true
if the name is case-sensitive.
-
DocumentName
Creates a document name with the name of the file and the same basename as the baseName document.- Parameters:
file
- the file to name the document from.baseName
- the DocumentName to provide the baseName.
-
DocumentName
Creates a document name with the name and basename equal to the file name- Parameters:
file
- the file name to use.
-
-
Method Details
-
resolve
Creates a new document name by adding the child to the current name.- Parameters:
child
- the child to add (must use directory separator from this document name).- Returns:
- the new document name with the same base name, directory separator and case sensitivity as this one.
-
getName
Gets the fully qualified name of the document.- Returns:
- the fully qualified name of the document.
-
getBaseName
Gets the fully qualified basename of the document.- Returns:
- the fully qualified basename of the document.
-
getBaseDocumentName
Gets the DocumentName for the basename of this document name.- Returns:
- the DocumentName for the basename of this document name.
-
getDirectorySeparator
Returns the directory separator.- Returns:
- the directory separator.
-
localized
Gets the portion of the name that is not part of the base name. The resulting name will always start with the directory separator.- Returns:
- the portion of the name that is not part of the base name.
-
localized
Gets the portion of the name that is not part of the base name. The resulting name will always start with the directory separator.- Parameters:
dirSeparator
- The character to use to separate directories in the result.- Returns:
- the portion of the name that is not part of the base name.
-
tokenize
Tokenizes the string based on the dirSeparator- Parameters:
source
- the source to tokenize- Returns:
- the array of tokenized strings.
-
getShortName
Gets the last segment of the name. This is the part after the last directory separator.- Returns:
- the last segment of the name.
-
isCaseSensitive
public boolean isCaseSensitive()Gets the case sensitivity flag.- Returns:
true
if the name is case-sensitive.
-
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<DocumentName>
-
equals
-
hashCode
public int hashCode()
-