JavaDoq 1.0 API

com.javadoq
Class JavaName

java.lang.Object
  extended by com.javadoq.JavaName

public final class JavaName
extends java.lang.Object

Represents fully qualified names in Java source code.

Note that a JavaName is read-only like a Java string.

Author:
J.J.Liu (Jianjun Liu) at http://www.javadoq.com

Field Summary
static JavaName EMPTY
          An empty JavaName.
 int firstDot
          Index of the first dot in the text.
 boolean isSimple
          Whether the JavaName is simple.
 int lastDot
          Index of the last dot in the text.
 int length
          Length of the text.
 java.lang.String text
          Text of the JavaName.
 
Constructor Summary
JavaName(java.lang.String text)
          Constructs a JavaName from a text string.
 
Method Summary
 JavaName addFirst(java.lang.String name)
          Adds a simple name to the beginning of the current JavaName.
 JavaName addLast(java.lang.String name)
          Adds a simple name to the end of the current JavaName.
 JavaName chopFirst()
          Chops the first part of the JavaName.
 JavaName chopFirst(JavaName head)
          Chops the specified head of the JavaName.
 JavaName chopLast()
          Chops the last part of the JavaName.
 boolean endsWith(JavaName name)
          Determines if the current JavaName ends with another name.
 boolean endsWith(java.lang.String simple)
          Determines if the current JavaName ends with a simple name.
 boolean equals(java.lang.Object o)
          Determines if the current JavaName equals another object.
 java.lang.String getFirst()
          Gets the first part of the JavaName.
 java.lang.String getLast()
          Gets the last part of the JavaName.
 int hashCode()
          Returns a hash code of the current JavaName.
 JavaName merge(JavaName name)
          Merges the specified JavaName to the end of the current one.
 java.lang.String path()
          Converts the JavaName to a directory path.
 boolean startsWith(JavaName name)
          Determines if the current JavaName starts with another name.
 boolean startsWith(java.lang.String simple)
          Determines if the current JavaName starts with a simple name.
 java.lang.String toString()
          Converts the JavaName to string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final JavaName EMPTY

An empty JavaName.

Since:
1.0

text

public final java.lang.String text

Text of the JavaName.

Since:
1.0

firstDot

public final int firstDot

Index of the first dot in the text.

Since:
1.0

lastDot

public final int lastDot

Index of the last dot in the text.

Since:
1.0

length

public final int length

Length of the text.

Since:
1.0

isSimple

public final boolean isSimple

Whether the JavaName is simple.

Since:
1.0
Constructor Detail

JavaName

public JavaName(java.lang.String text)

Constructs a JavaName from a text string.

Parameters:
text - The text for the JavaName being constructed.
Since:
1.0
Method Detail

path

public final java.lang.String path()

Converts the JavaName to a directory path.

Returns:
A string of the directory path.
Since:
1.0

toString

public java.lang.String toString()

Converts the JavaName to string.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of the JavaName.
Since:
1.0

equals

public boolean equals(java.lang.Object o)

Determines if the current JavaName equals another object.

Overrides:
equals in class java.lang.Object
Parameters:
o - An object.
Returns:
true if the given object is an instance of JavaName and its text is equal to that of the current one.
Since:
1.0

hashCode

public int hashCode()

Returns a hash code of the current JavaName.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code of the current JavaName that is same as that of its text.
Since:
1.0

getFirst

public final java.lang.String getFirst()

Gets the first part of the JavaName.

Returns:
The first part of the JavaName or null if the JavaName is simple.
Since:
1.0

getLast

public final java.lang.String getLast()

Gets the last part of the JavaName.

Returns:
The last part of the JavaName or null if the JavaName is simple.
Since:
1.0

chopFirst

public final JavaName chopFirst()

Chops the first part of the JavaName.

Returns:
The result JavaName or the current one itself if it is simple.
Since:
1.0

chopLast

public final JavaName chopLast()

Chops the last part of the JavaName.

Returns:
The result JavaName or the current one itself if it is simple.
Since:
1.0

addFirst

public final JavaName addFirst(java.lang.String name)

Adds a simple name to the beginning of the current JavaName.

Parameters:
name - A simple name to add.
Returns:
The result JavaName.
Since:
1.0

addLast

public final JavaName addLast(java.lang.String name)

Adds a simple name to the end of the current JavaName.

Parameters:
name - A simple name to add.
Returns:
The result JavaName.
Since:
1.0

startsWith

public final boolean startsWith(java.lang.String simple)

Determines if the current JavaName starts with a simple name.

Parameters:
simple - A simple name.
Returns:
true if if the current JavaName starts with the specified simple name; false, otherwise.
Since:
1.0

startsWith

public final boolean startsWith(JavaName name)

Determines if the current JavaName starts with another name.

Parameters:
name - Another JavaName.
Returns:
true if if the current JavaName starts with the specified JavaName; false, otherwise.
Since:
1.0

endsWith

public final boolean endsWith(java.lang.String simple)

Determines if the current JavaName ends with a simple name.

Parameters:
simple - A simple name.
Returns:
true if if the current JavaName ends with the specified simple name; false, otherwise.
Since:
1.0

endsWith

public final boolean endsWith(JavaName name)

Determines if the current JavaName ends with another name.

Parameters:
name - Another JavaName.
Returns:
true if if the current JavaName ends with the specified JavaName; false, otherwise.
Since:
1.0

chopFirst

public final JavaName chopFirst(JavaName head)

Chops the specified head of the JavaName.

Parameters:
head - A head for the current name.
Returns:
The result JavaName or the current one does not starts with the specified head.
Since:
1.0

merge

public final JavaName merge(JavaName name)

Merges the specified JavaName to the end of the current one.

Parameters:
name - A JavaName.
Returns:
The result JavaName.
Since:
1.0

JavaDoq 1.0 API

Copyright © 2008-2011 J.J.Liu (www.javadoq.com). All Rights Reserved.