org.objectweb.jonathan.libs.helpers
Class NameHelpers
java.lang.Object
org.objectweb.jonathan.libs.helpers.NameHelpers
public final class NameHelpers
extends java.lang.Object
Somme helper functions on
names
.
append
public static Name append(Name _name1,
String _id,
char _separator)
append
public static Name append(Name _name1,
Name _name2)
Appends _name1 and _name2.
_name1
- a name;_name2
- another name;
- the concatenation of both names.
getPrefix
public static Name getPrefix(Name _name)
Returns the prefix of
_name
.
If
_name
may be represented as "a/b/c", with '/' as a separator,
then getPrefix returns "a/b".
_name
- a name;
- the prefix composed of all the name components but the last one.
getSuffix
public static Name getSuffix(Name _name)
Returns the suffix of
_name
.
If
_name
may be represented as "a/b/c", with '/' as a separator,
then getSuffix returns "c".
_name
- a name;
- the last component of name.
newName
public static Name newName(String _name,
char separator)
Creates a new name by parsing the provided string.
If
separator == 0
,
_name
is considered as a
simple identifier, and this call returns
newName(_name,null)
.
If the name begins with the separator, the name is an absolute name (this
only makes sense if contexts with a tree structure); otherwise, the name is
relative.
_name
- a string representing a name;separator
- a separator to parse it.
- a
Name
.
newName
public static Name newName(String _id,
Name _subname)
Returns a new
Name
, using
_id
as identifier,
and
_subname
as subname.
_id
- a String identifier;_subname
- a name;
- a new
Name
, using _id
as identifier,
and _subname
as subname.
toString
public static String toString(Name _name,
char _separator)