public abstract class EndTagType extends TagType
An end tag type is a TagType
that starts with the characters '</
'.
The singleton instances of all the standard end tag types are available in this class as static fields.
Because all EndTagType
instaces must be singletons, the '==
' operator can be used to test for a particular tag type
instead of the equals(Object)
method.
StartTagType
Modifier and Type | Field and Description |
---|---|
static EndTagType |
NORMAL
The tag type given to a normal HTML or XML end tag (
</name> ). |
static EndTagType |
UNREGISTERED
|
Modifier | Constructor and Description |
---|---|
protected |
EndTagType(java.lang.String description,
java.lang.String startDelimiter,
java.lang.String closingDelimiter,
boolean isServerTag)
Constructs a new
EndTagType object with the specified properties. |
Modifier and Type | Method and Description |
---|---|
protected EndTag |
constructEndTag(Source source,
int begin,
int end,
java.lang.String name)
Internal method for the construction of an
EndTag object of this type. |
java.lang.String |
generateHTML(java.lang.String startTagName)
|
StartTagType |
getCorrespondingStartTagType()
|
java.lang.String |
getEndTagName(java.lang.String startTagName)
Returns the end tag name that is required to match a corresponding start tag with the specified name.
|
public static final EndTagType UNREGISTERED
</ ... >
).
See the documentation of the Tag.isUnregistered()
method for details.
Property/Method | Value |
---|---|
Description | /unregistered |
StartDelimiter | </
|
ClosingDelimiter | >
|
IsServerTag | false
|
NamePrefix | (empty string) |
CorrespondingStartTagType | null
|
generateHTML ("StartTagName") | </StartTagName>
|
</ "This is not recognised as any of the predefined end tag types in this library">
StartTagType.UNREGISTERED
public static final EndTagType NORMAL
</name>
).
Property/Method | Value |
---|---|
Description | /normal |
StartDelimiter | </
|
ClosingDelimiter | >
|
IsServerTag | false
|
NamePrefix | (empty string) |
CorrespondingStartTagType | StartTagType.NORMAL
|
generateHTML ("StartTagName") | </StartTagName>
|
</div>
protected EndTagType(java.lang.String description, java.lang.String startDelimiter, java.lang.String closingDelimiter, boolean isServerTag)
EndTagType
object with the specified properties.
As EndTagType
is an abstract class, this constructor is only called from sub-class constructors.
description
- a description of the new end tag type useful for debugging purposes.startDelimiter
- the start delimiter of the new end tag type.closingDelimiter
- the closing delimiter of the new end tag type.isServerTag
- indicates whether the new end tag type is a server tag.public StartTagType getCorrespondingStartTagType()
Element
.
The default implementation returns null
.
This property is informational only and is not used by the parser in any way.
The mapping of end tag type to the corresponding start tag type is in any case one-to-many, which is why the definition
emphasises the word "usually".
An example of this is the PHPTagTypes.PHP_SCRIPT
start tag type,
whose corresponding end tag type is EndTagType.NORMAL
,
while the converse is not true.
The only predefined end tag type that returns null
for this property is the
special UNREGISTERED
end tag type.
Although this method is used like a property method, it is implemented as a
default implementation method to avoid cyclic references between statically
instantiated StartTagType
and EndTagType
objects.
End Tag Type | Corresponding Start Tag Type |
---|---|
UNREGISTERED | null
|
NORMAL | StartTagType.NORMAL
|
End Tag Type | Corresponding Start Tag Type |
---|---|
MasonTagTypes.MASON_COMPONENT_CALLED_WITH_CONTENT_END | MasonTagTypes.MASON_COMPONENT_CALLED_WITH_CONTENT
|
MasonTagTypes.MASON_NAMED_BLOCK_END | MasonTagTypes.MASON_NAMED_BLOCK
|
Element
.StartTagType.getCorrespondingEndTagType()
public java.lang.String getEndTagName(java.lang.String startTagName)
This default implementation simply returns startTagName
.
Note that the startTagName
parameter should include the start tag's name prefix if it has one.
startTagName
- the name of a corresponding start tag, including its name prefix.public java.lang.String generateHTML(java.lang.String startTagName)
This default implementation returns "</"+
getEndTagName
(startTagName)+
TagType.getClosingDelimiter()
.
Note that the startTagName
parameter should include the start tag's name prefix if it has one.
startTagName
- the name of a corresponding start tag, including its name prefix.protected final EndTag constructEndTag(Source source, int begin, int end, java.lang.String name)
EndTag
object of this type.
Intended for use from within the constructTagAt(Source, int pos)
method.