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


@Documented
@Retention
@Target
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(), Kroll.proxy.creatableInModule()

Optional Element Summary
 String id
          This ID will be used when a user tries to load a module by using "require", for example:
 String name
          The name of this module in the API.
 Class<?> parentModule
          The parent module class of this module.
 String[] propertyAccessors
          Declares a list of dynamic property accessors for this module.
Example:
 

name

public abstract 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 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 Class<?> parentModule
The parent module class of this module.

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

propertyAccessors

public abstract 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-2012 Appcelerator, Inc. Licensed under the Apache License 2.0