Copyright© 2008-2018 SiteVision AB, all rights reserved.
@Documented
@Retention(value=SOURCE)
@Target(value={TYPE,FIELD})
public @interface Requireable
require
function.
All utilities, factories and builders below the senselogic.sitevision.api
package are annotated with the Requireable
annotation. The value of the annotation is always the actual
name of the annotated utility/factory/builder. For example:
PropertyUtil
is annotated with @Requireable("PropertyUtil")
SearchFactory
is annotated with @Requireable("SearchFactory")
MailBuilder
is annotated with @Requireable("MailBuilder")
Everything in the API that is annotated with Requireable
can be loaded with the new require function
in server-side javascript executed by SiteVision. In other words - as of SiteVision 4.0 you typically only need to know
the name of a specific utility/factory/builder to load it (via the require function). You typically
no longer need to know what specific interface and method you must use to get it.
This is an example of typical javascript code in a Script portlet:
var sitevisionUtils = request.getAttribute('sitevision.utils'); // Get the Utils instance, the 'hook' to get API utilities
var propertyUtil = sitevisionUtils.getPropertyUtil();
var userIdentityUtil = sitevisionUtils.getUserFactory().getUserIdentityUtil();
...
This is how the equivalent code typically would be written as of SiteVision 4.0:
var sitevisionUtils = request.getAttribute('sitevision.utils');
var propertyUtil = require('PropertyUtil');
var userIdentityUtil = require('UserIdentityUtil');
...
Note that requireable instances isn't always available in all script engines, see engine()
Modifier and Type | Required Element and Description |
---|---|
String |
value
The name that identifies the requireable instance.
|
Modifier and Type | Optional Element and Description |
---|---|
Requireable.ScriptEngine[] |
engine
Script engines that supports the requireable instance
(i.e. the engines where the require function will be available for the requireable instance).
|
public abstract String value
public abstract Requireable.ScriptEngine[] engine
SiteVision - Portal and Content Management Made Easy
SiteVision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2018 SiteVision AB, all rights reserved.