public class TagManager extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
log
Logger
|
| Modifier and Type | Method and Description |
|---|---|
static DefaultObjectHandler |
getTagHandler(Class<?> klass) |
static DefaultObjectHandler |
getTagHandler(ClassDescriptor beanClass) |
static TagHandler |
getTagHandler(String namespace,
String tag,
boolean namespacePrefix,
JAXXCompiler compiler)
Returns the
TagHandler that should be used to process the
specified tag. |
static TagHandler |
getTagHandler(String namespace,
String tag,
JAXXCompiler compiler)
Returns the
TagHandler that should be used to process the
specified tag. |
static <T extends TagHandler> |
registerBean(ClassDescriptor beanClass,
Class<T> handler)
Maps a class tag to a specific
TagHandler. |
static void |
registerDefaultNamespace(String tag,
String namespace)
Sets the default namespace for a tag.
|
static <T extends TagHandler> |
registerTag(String namespace,
String tag,
T handler)
Registers a
TagHandler for a tag. |
static void |
reset() |
static ClassDescriptor |
resolveClass(String className,
JAXXCompiler compiler) |
static String |
resolveClassName(String name,
JAXXCompiler compiler)
Resolves a simple class name (like
Object or
String) to its fully-qualified name. |
public static void reset()
public static <T extends TagHandler> void registerBean(ClassDescriptor beanClass, Class<T> handler)
TagHandler.
When a tag representing the bean class is encountered (either the
class' simple name, if it is unambiguous, or its fully-qualified name),
the specified TagHandler will be invoked to run it.T - type of handlerbeanClass - the class to associate with a TagHandlerhandler - the TagHandler class, which must descend
from DefaultObjectHandlerIllegalArgumentException - if the handler class does not descend
from DefaultObjectHandlerpublic static void registerDefaultNamespace(String tag, String namespace)
null value into the map); this causes an
error to be thrown if the tag is used without a namespace being specified.
Java package names on tags are automatically converted into namespaces
(e.g. <javax.swing.JButton/> and
<JButton xmlns="javax.swing.*"/> are equivalent), so tags with
package names are considered to have namespaces specified.tag - tag namenamespace - namespacepublic static <T extends TagHandler> void registerTag(String namespace, String tag, T handler)
TagHandler for a tag.
When a tag with the given name and namespace is encountered, the
TagHandler's compileFirstPass and compileSecondPass
methods will be invoked to handle it.
It is not an error to register an already-registered tag and namespace
combination. The new mapping will replace the old mapping.T - type of handlernamespace - the tag's namespacetag - the simple name of the taghandler - the TagHandler which should process the tagpublic static TagHandler getTagHandler(String namespace, String tag, JAXXCompiler compiler) throws CompilerException
TagHandler that should be used to process the
specified tag.
If the tag represents the class name of an uncompiled .jaxx
file, the .jaxx is first compiled.namespace - the tag's namespace (may be null)tag - the tag's simple namecompiler - the current JAXXCompilerTagHandler for the tagCompilerException - ?public static DefaultObjectHandler getTagHandler(Class<?> klass) throws CompilerException
klass - the java classTagHandler that should be used to process the
specified class.
Only TagHandlers previously registered with
registerBean are considered.CompilerException - ?public static DefaultObjectHandler getTagHandler(ClassDescriptor beanClass) throws CompilerException
beanClass - the tag classTagHandler that should be used to process the
specified class.
Only TagHandlers previously registered with
registerBean are considered.CompilerException - ?public static TagHandler getTagHandler(String namespace, String tag, boolean namespacePrefix, JAXXCompiler compiler) throws CompilerException
TagHandler that should be used to process the
specified tag.
The namespacePrefix parameter is used only for error
checking, as it is an error to specify conflicting package names using
both a fully-qualified tag name and a namespace prefix, but it is not
an error to specify conflicting package names using a fully-qualified
tag name and a default namespace (i.e.
<awt:javax.swing.JButton xmlns:awt='java.awt.*'/>
is an error, whereas <javax.swing.JButton xmlns='java.awt.*'/> is not).namespace - the tag's namespace (may be null)tag - the tag's simple name (which can include
fully-qualified Java class names)namespacePrefix - true if the namespace was specified
by means of a namespace prefix (as opposed to a
default namespace)compiler - the current JAXXCompilerTagHandler for the tagCompilerException - ?public static String resolveClassName(String name, JAXXCompiler compiler)
Object or
String) to its fully-qualified name.
Inner classes should be represented as they would appear in Java source
code (e.g. JPopupMenu.Separator). Fully-qualified names, such as
java.lang.Object are legal and will be returned unmodified
(and in fact it is generally impossible to even know whether a given
reference is fully qualified until it has been resolved).
Returns null if no matching class could be found.name - name to resolvecompiler - run to usepublic static ClassDescriptor resolveClass(String className, JAXXCompiler compiler)
Copyright © 2008–2017 Ultreia.io. All rights reserved.