Package org.jdom2
Enum Class Content.CType
- All Implemented Interfaces:
Serializable
,Comparable<Content.CType>
,Constable
- Enclosing class:
Content
An enumeration useful for identifying content types without
having to do
instanceof
type conditionals.
instanceof
is not a particularly safe way to test content
in JDOM because CDATA extends Text ( a CDATA instance is an
instanceof
Text).
This CType enumeration provides a direct and sure mechanism for identifying JDOM content.
These can be used in switch-type statements too (which is much neater than chained if (instanceof) else if (instanceof) else .... expressions):
switch(content.getCType()) { case Text : ..... break; case CDATA : ..... break; .... }
- Since:
- JDOM2
- Author:
- Rolf Lear
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic Content.CType
Returns the enum constant of this class with the specified name.static Content.CType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-