站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

IntrospectedInfo (Ant) - NetBeans API Javadoc (Current Development Version)

org.apache.tools.ant.module/3 3.27.0 2

org.apache.tools.ant.module.api
Class IntrospectedInfo

java.lang.Object
  extended by org.apache.tools.ant.module.api.IntrospectedInfo

public final class IntrospectedInfo
extends Object

Represents Ant-style introspection info for a set of classes. There should be one instance which is loaded automatically from defaults.properties files, i.e. standard tasks/datatypes. A second is loaded from settings and represents custom tasks/datatypes. Uses Ant's IntrospectionHelper for the actual work, but manages the results and makes them safely serializable (stores only classnames, etc.).

All task and type names may be namespace-qualified for use in Ant 1.6: a name of the form nsuri:localname refers to an XML element with namespace nsuri and local name localname. Attribute names could also be similarly qualified, but in practice attributes used in Ant never have a defined namespace. The prefix antlib:org.apache.tools.ant: is implied, not expressed, on Ant core element names (for backwards compatibility). Subelement names are *not* namespace-qualified here, even though in the script they would be - because the namespace used in the script will actually vary according to how an antlib is imported and used. An unqualified subelement name should be understood to inherit a namespace from its parent element. (Namespace support since org.apache.tools.ant.module/3 3.6)


Constructor Summary
IntrospectedInfo()
          Make new empty set of info.
 
Method Summary
 void addChangeListener(ChangeListener l)
          Add a listener to changes in the definition set.
 Map<String,String> getAttributes(String clazz)
          Get all attributes supported by this class.
static IntrospectedInfo getDefaults()
          Get default definitions specified by Ant's defaults.properties.
 Map<String,String> getDefs(String kind)
          Get definitions.
 Map<String,String> getElements(String clazz)
          Get all subelements supported by this class.
static IntrospectedInfo getKnownInfo()
          Get all known introspected definitions.
 String[] getTags(String clazz)
          Get tags represented by this class if it is an EnumeratedAttribute.
 boolean isKnown(String clazz)
          Is anything known about this class?
 void register(String name, Class clazz, String kind)
          Register a new definition.
 void removeChangeListener(ChangeListener l)
          Remove a listener to changes in the definition set.
 void scanProject(Map<String,Map<String,Class>> defs)
          Scan an existing (already-run) project to see if it has any new tasks/types.
 boolean supportsText(String clazz)
          Does this class support inserting text data?
 String toString()
           
 void unregister(String name, String kind)
          Unregister a definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntrospectedInfo

public IntrospectedInfo()
Make new empty set of info.

Method Detail

getDefaults

public static IntrospectedInfo getDefaults()
Get default definitions specified by Ant's defaults.properties.

Returns:
the singleton defaults

addChangeListener

public void addChangeListener(ChangeListener l)
Add a listener to changes in the definition set.

Parameters:
l - the listener to add
Since:
2.6

removeChangeListener

public void removeChangeListener(ChangeListener l)
Remove a listener to changes in the definition set.

Parameters:
l - the listener to remove
Since:
2.6

getDefs

public Map<String,String> getDefs(String kind)
Get definitions.

Parameters:
kind - the kind of definition, e.g. task
Returns:
an immutable map from definition names to class names

isKnown

public boolean isKnown(String clazz)
Is anything known about this class?

Parameters:
clazz - the class name
Returns:
true if it is known, false if never encountered

supportsText

public boolean supportsText(String clazz)
                     throws IllegalArgumentException
Does this class support inserting text data?

Parameters:
clazz - the class name
Returns:
true if so
Throws:
IllegalArgumentException - if the class is unknown

getAttributes

public Map<String,String> getAttributes(String clazz)
                                 throws IllegalArgumentException
Get all attributes supported by this class.

Parameters:
clazz - the class name
Returns:
an immutable map from attribute name to type (class name)
Throws:
IllegalArgumentException - if the class is unknown

getElements

public Map<String,String> getElements(String clazz)
                               throws IllegalArgumentException
Get all subelements supported by this class.

Parameters:
clazz - the class name
Returns:
an immutable map from element name to type (class name)
Throws:
IllegalArgumentException - if the class is unknown

getTags

public String[] getTags(String clazz)
                 throws IllegalArgumentException
Get tags represented by this class if it is an EnumeratedAttribute.

Parameters:
clazz - the class name
Returns:
a list of tag names, or null if the class is not a subclass of EnumeratedAttribute
Throws:
IllegalArgumentException - if the class is unknown
Since:
org.apache.tools.ant.module/3 3.3

register

public void register(String name,
                     Class clazz,
                     String kind)
Register a new definition. May change the defined task/type for a given name, but will not redefine structure if classes are modified. Also any class definitions contained in the default map (if not this one) are just ignored; you should refer to the default map for info on them. Throws various errors if the class could not be resolved, e.g. NoClassDefFoundError.

Parameters:
name - name of the task or type as it appears in scripts
clazz - the implementing class
kind - the kind of definition to register (task or type currently)
Since:
2.4

unregister

public void unregister(String name,
                       String kind)
Unregister a definition. Removes it from the definition mapping, though structural information about the implementing class (and classes referenced by that class) will not be removed. If the definition was not registered before, does nothing.

Parameters:
name - the definition name
kind - the kind of definition (task etc.)
Since:
2.4

scanProject

public void scanProject(Map<String,Map<String,Class>> defs)
Scan an existing (already-run) project to see if it has any new tasks/types. Any new definitions found will automatically be added to the known list. This will try to change existing definitions in the custom set, i.e. if a task is defined to be implemented with a different class, or if a class changes structure. Will not try to define anything contained in the defaults list.

Parameters:
defs - map from kinds to maps from names to classes

toString

public String toString()
Overrides:
toString in class Object

getKnownInfo

public static IntrospectedInfo getKnownInfo()
Get all known introspected definitions. Includes all those in getDefaults() plus custom definitions encountered in actual build scripts (details unspecified).

Returns:
a set of all known definitions, e.g. of tasks and types
Since:
2.14

org.apache.tools.ant.module/3 3.27.0 2

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.