|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjaxx.compiler.tags.TagManager
public class TagManager
Manages TagHandlers, including automatically compiling .jaxx files corresponding to class tags.
| Field Summary | |
|---|---|
protected static org.apache.commons.logging.Log |
log
Logger |
| Method Summary | ||
|---|---|---|
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
|
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
|
registerTag(String namespace,
String tag,
T handler)
Registers a TagHandler for a tag. |
|
static void |
reset(boolean verbose)
|
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.commons.logging.Log log
| Method Detail |
|---|
public static void reset(boolean verbose)
throws IOException,
ClassNotFoundException,
InstantiationException,
IllegalAccessException
IOException
ClassNotFoundException
InstantiationException
IllegalAccessException
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 DefaultObjectHandler
IllegalArgumentException - if the handler class does not descend from DefaultObjectHandler
public 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 - namespace
public 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 tag
public 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 JAXXCompiler
TagHandler for the tag
CompilerException - ?
public static DefaultObjectHandler getTagHandler(ClassDescriptor beanClass)
throws CompilerException
beanClass - the tag class
TagHandler 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 JAXXCompiler
TagHandler for the tag
CompilerException - ?
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 use
public static ClassDescriptor resolveClass(String className,
JAXXCompiler compiler)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||