JavaElementUtil Class
- public class JavaElementUtil
extends Object
Utility methods for dealing with elements in a JavaDocument tree.
-
Hierarchy
-
Object
JavaElementUtil
public static String |
-
checkName (JavaMember element, String newName)
- verify that the propsed new name is allowed.
|
public static JavaDocAttribute |
-
findAttribute (JavaElement element, String tagPrefixedName, String attrName)
- Finds a JavaDocAttribute on an element.
|
public static JavaDocAttribute |
-
findAttribute (JavaElement element, String tagPrefix, String tagName, String attrName)
- Finds a JavaDocAttribute on an element.
|
public static String |
-
findAttributeValue (JavaElement element, String tagPrefixedName, String attrName)
- Find the value of a JavaDocAttribute.
|
public static String |
-
findAttributeValue (JavaElement element, String tagPrefix, String tagName, String attrName)
- Find the value of a JavaDocAttribute.
|
public static JavaElement |
-
findMatchingChildElement (JavaElement parent, JavaElement el)
- This method will return the child of a parent element that matches a supplied element.
|
public static JavaElement |
-
findMatchingElement (JavaDocument doc, JavaElement el)
- Searches the element tree of the given document for
an element equivalent in property and position to the
given element.
|
public static JavaDocTag |
-
findTag (JavaElement element, String tagPrefixedName)
- Finds a JavaDocTag on an element.
|
public static JavaDocTag |
-
findTag (JavaElement element, String tagPrefix, String tagName)
- Finds a JavaDocTag on an element.
|
public static JavaElement |
-
getFirstChildByType (JavaElement parent, Class childType)
- Returns the first child of a specified type.
|
public static String |
-
getFullClassName (JavaClass c)
- Returns the complete classname for the given class.
|
public static String |
-
getLogicalSignature (JavaMethod method)
- Returns the string representation of the java signature, with no argument names.
|
Methods from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JavaElementUtil
public JavaElementUtil()
checkName(JavaMember, String) Method
public static String
checkName(JavaMember
element,
String
newName)
verify that the propsed new name is allowed.
Parameters
-
element
- the element to rename.
-
newName
- the proposed new name.
Returns
- null if newName is ok, or an error string if not.
findAttribute(JavaElement, String, String) Method
public static JavaDocAttribute
findAttribute(JavaElement
element,
String
tagPrefixedName,
String
attrName)
Finds a JavaDocAttribute on an element.
Parameters
-
element
- The Element that may have the given tag on it.
-
tagPrefixedName
- The full name (prefix:name) of the tag to find.
-
attrName
- The name of the attribute to find.
Returns
- The attribute, or null if it does not exist on the given element.
findAttribute(JavaElement, String, String, String) Method
public static JavaDocAttribute
findAttribute(JavaElement
element,
String
tagPrefix,
String
tagName,
String
attrName)
Finds a JavaDocAttribute on an element.
Parameters
-
element
- The Element that may have the given tag on it.
-
tagPrefix
- The prefix of the tag to find. If this is null, any prefix will be
accepted.
-
tagName
- The name of the tag to find.
-
attrName
- The name of the attribute to find.
Returns
- The attribute, or null if it does not exist on the given element.
findAttributeValue(JavaElement, String, String) Method
public static String
findAttributeValue(JavaElement
element,
String
tagPrefixedName,
String
attrName)
Find the value of a JavaDocAttribute.
Returns
- the value of the attribute, or null if it wasn't found.
Related Topics
JavaElementUtil.findAttribute(JavaElement, String, String)
findAttributeValue(JavaElement, String, String, String) Method
public static String
findAttributeValue(JavaElement
element,
String
tagPrefix,
String
tagName,
String
attrName)
Find the value of a JavaDocAttribute.
Returns
- the value of the attribute, or null if it wasn't found.
Related Topics
JavaElementUtil.findAttribute(JavaElement, String, String)
findMatchingChildElement(JavaElement, JavaElement) Method
public static JavaElement
findMatchingChildElement(JavaElement
parent,
JavaElement
el)
This method will return the child of a parent element that matches a supplied element. This comparision
is based on the type, properties, and children of the element, but does not perform an object equality test.
Parameters
-
parent
- The parent to be searched
-
el
- The element whose match is desired
Returns
- The element found, null if no match was discovered
findMatchingElement(JavaDocument, JavaElement) Method
public static JavaElement
findMatchingElement(JavaDocument
doc,
JavaElement
el)
Searches the element tree of the given document for
an element equivalent in property and position to the
given element. This is used to find the new
version of a stale element. If the element is not stale and
is in the same document, it will be returned directly.
Parameters
-
doc
- the Document to search for a new element.
-
el
- the Element from a different (or same, if stale)
document whose non-stale twin is needed. Null will be returned
if it's not found for any reason.
findTag(JavaElement, String) Method
public static JavaDocTag
findTag(JavaElement
element,
String
tagPrefixedName)
Finds a JavaDocTag on an element.
Parameters
-
element
- The Element that may have the given tag on it.
-
tagPrefixedName
- The full name (prefix:name) of the tag to find.
Returns
- The tag, or null if it does not exist on the given element.
findTag(JavaElement, String, String) Method
public static JavaDocTag
findTag(JavaElement
element,
String
tagPrefix,
String
tagName)
Finds a JavaDocTag on an element.
Parameters
-
element
- The Element that may have the given tag on it.
-
tagPrefix
- The prefix of the tag to find. If this is null, any prefix will be
accepted.
-
tagName
- The name of the tag to find.
Returns
- The tag, or null if it does not exist on the given element.
getFirstChildByType(JavaElement, Class) Method
public static JavaElement
getFirstChildByType(JavaElement
parent,
Class
childType)
Returns the first child of a specified type.
Parameters
-
parent
- The element whose children should be searched.
-
childType
- The child type desired.
Returns
- The first child found, or null if not children of the specified type exist on the parent.
getFullClassName(JavaClass) Method
public static String
getFullClassName(JavaClass
c)
Returns the complete classname for the given class.
getLogicalSignature(JavaMethod) Method
public static String
getLogicalSignature(JavaMethod
method)
Returns the string representation of the java signature, with no argument names.