org.appcelerator.kroll.annotations
Annotation Type Kroll.module


@Documented
@Retention(value=SOURCE)
@Target(value=TYPE)
public static @interface Kroll.module

Declares a Kroll module.
Modules differ from proxies by being statically bound to an API point, and by only having a singleton instance (by default).
Modules may also have a parent module, and are where Kroll.proxy "create" methods are generated. For more on this, see Kroll.proxy.creatableInModule().
Module classes must extend KrollModule (which is itself an extension of KrollProxy).
Example:

 @Kroll.module
 public class APIModule extend KrollModule { .. }
 

See Also:
name(), parentModule(), contextSpecific(), Kroll.proxy.creatableInModule()

Optional Element Summary
 boolean contextSpecific
          Warning: This is reserved for future use, and not implemented yet When set to true, this module will be instantiated for every TiContext that is created (instead of only once for the entire application).
 java.lang.String id
          This ID will be used when a user tries to load a module by using "require", for example:
 java.lang.String name
          The name of this module in the API.
 java.lang.Class<?> parentModule
          The parent module class of this module.
 java.lang.String[] propertyAccessors
          Declares a list of dynamic property accessors for this module.
Example:
 

name

public abstract java.lang.String name

The name of this module in the API. If this module has a parent module, this name will be relative to the parent. All modules are relative to the top level

Titanium
object. If you wish to bind to the global object, see @Kroll.topLevel

Default Value:
If the class name follows the naming convention
XYZModule
, then the default API name is
XYZ
. Otherwise, the default name is the same as the class name.
Default:
"__default_name__"

id

public abstract java.lang.String id
This ID will be used when a user tries to load a module by using "require", for example:
 var MyModule = require('com.mycompany.mymodule');
 
 @Kroll.module(name="MyModule", id="com.mycompany.mymodule")
 public class MyModule extends KrollModule { ... }
 

Default Value:
The fully qualified class name of the module
Default:
"__default_name__"

parentModule

public abstract java.lang.Class<?> parentModule
The parent module class of this module.

Default Value:
No parent module (binds directly to
Titanium
)
Default:
org.appcelerator.kroll.annotations.Kroll.module.DEFAULT.class

contextSpecific

public abstract boolean contextSpecific
Warning: This is reserved for future use, and not implemented yet When set to true, this module will be instantiated for every TiContext that is created (instead of only once for the entire application).

Default:
false

propertyAccessors

public abstract java.lang.String[] propertyAccessors
Declares a list of dynamic property accessors for this module.
Example:
 @Kroll.module(propertyAccessors={"property1", "property2", "property3"})
 

Default Value:
No dynamic property accessors are generated
Default:
{}


Copyright © 2010 Appcelerator, Inc. Licensed under the Apache License 2.0