Class Name
java.lang.Object
com.github.cafapi.common.util.naming.Name
A class that is similar to java.naming.Name, but is iterable. A Name is a tokenized character String, delimited by forward-slashes.
-
Constructor Details
-
Name
Create a new Name. Leading and trailing forward-slashes are allowed.- Parameters:
name
- the String to create the name from
-
Name
Createa a new Name from a list of tokens.- Parameters:
components
- the parts that will make up the Name, already tokenized into a List
-
-
Method Details
-
size
public int size()- Returns:
- the number of tokenized components of this Name
-
getIndex
Get the components of the Name at the specified numeric index- Parameters:
index
- the index of the token to return, starting from 0- Returns:
- the requested Name component
- Throws:
IllegalArgumentException
- if you request an index that does not exist
-
getPrefix
Return a Name that consists of a subsection of the current Name.- Parameters:
upperIndex
- the upper index (exclusive) of components to build the Name from- Returns:
- a new Name, that is a sub-set of the current Name
- Throws:
IllegalArgumentException
- if you request an index that is no in the range of components of this Name
-
toString
-
iterator
-
equals
-
hashCode
public int hashCode()
-