本文整理汇总了Java中org.mozilla.javascript.UniqueTag类的典型用法代码示例。如果您正苦于以下问题:Java UniqueTag类的具体用法?Java UniqueTag怎么用?Java UniqueTag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UniqueTag类属于org.mozilla.javascript包,在下文中一共展示了UniqueTag类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getParameterValue
import org.mozilla.javascript.UniqueTag; //导入依赖的package包/类
@Override
public Object getParameterValue(String parameterName) throws EngineException {
Object variableValue = null;
int variableVisibility = getVariableVisibility(parameterName);
// Scope parameter
if (scope != null) {
variableValue = scope.get(parameterName, scope);
if (variableValue instanceof Undefined)
variableValue = null;
if (variableValue instanceof UniqueTag && ((UniqueTag) variableValue).equals(UniqueTag.NOT_FOUND))
variableValue = null;
if (variableValue != null)
Engine.logBeans.trace("(SqlTransaction) scope value: "+ Visibility.Logs.printValue(variableVisibility,variableValue));
}
if (variableValue == null) {
variableValue = super.getParameterValue(parameterName);
}
return variableValue = ((variableValue == null)? new String(""):variableValue);
}
示例2: jsFunction_SetParameterValues
import org.mozilla.javascript.UniqueTag; //导入依赖的package包/类
public static int jsFunction_SetParameterValues(Context cx, Scriptable thisObj, Object[] args, Function funObj) {
Cpe _this = (Cpe) thisObj;
SetParameterValues msg_in = new SetParameterValues();
Scriptable params = (Scriptable) args[0];
if (args.length > 1) {
msg_in.key = (String) args[1];
}
// int l = (int)params.getLength();
int l = (int) params.getIds().length;
for (int i = 0; i < l; i++) {
Scriptable nv = (Scriptable) params.get(i, params);
String n = (String) nv.get("name", nv);
Object ov = nv.get("value", nv);
String v = ov.toString();
Object ot = nv.get("type", nv);
if (ot.equals(UniqueTag.NOT_FOUND)) {
msg_in.AddValue(n, v);
} else {
msg_in.AddValue(n, v, (String) ot);
}
}
SetParameterValuesResponse msg_out = (SetParameterValuesResponse) _this.Call(msg_in);
return msg_out.Status;
}
示例3: get
import org.mozilla.javascript.UniqueTag; //导入依赖的package包/类
@Override
public Object get(String name, Scriptable start) {
Object value = super.get(name, start);
if (value != null && value != UniqueTag.NOT_FOUND) {
return value;
}
if (mGetter != null) {
value = mGetter.call(Context.getCurrentContext(), start, start, new Object[]{name});
}
return value;
}
示例4: get
import org.mozilla.javascript.UniqueTag; //导入依赖的package包/类
@Override
public Object get(String name, Scriptable start) {
Object value = super.get(name, start);
if (value != null && value != UniqueTag.NOT_FOUND && !value.equals(org.mozilla.javascript.Context.getUndefinedValue())) {
return value;
}
value = mProperties.get(name);
if (value != null)
return value;
return UniqueTag.NOT_FOUND;
}
示例5: hasValue
import org.mozilla.javascript.UniqueTag; //导入依赖的package包/类
private static boolean hasValue(Object object) {
return !(
(object == null) ||
(object instanceof Undefined) ||
(object instanceof UniqueTag)
);
}
示例6: getDefaultFiscalYearStartDate
import org.mozilla.javascript.UniqueTag; //导入依赖的package包/类
private static Calendar getDefaultFiscalYearStartDate(
IScriptFunctionContext context )
{
// Get customized value from appContext or system
Object property = context == null ? null
: context.findProperty( PROPERTY_FISCAL_YEAR_START_DATE );
if ( property == null || property == UniqueTag.NOT_FOUND )
{
property = System.getProperty( PROPERTY_FISCAL_YEAR_START_DATE );
}
Calendar start = Calendar.getInstance( );
if ( property != null )
{
try
{
Date date = FISCAL_YEAR_DATE_FORMAT.parse( property.toString( ) );
start.setTime( date );
return start;
}
catch ( ParseException e )
{
logger.log( Level.WARNING, e.getLocalizedMessage( ) );
}
}
// Default value is July 1 of current year
start.set( Calendar.MONTH, 6 );
start.set( Calendar.DAY_OF_MONTH, 1 );
start.set( Calendar.HOUR_OF_DAY, 0 );
start.set( Calendar.MINUTE, 0 );
start.set( Calendar.SECOND, 0 );
start.set( Calendar.MILLISECOND, 0 );
return start;
}
示例7: processTemplate
import org.mozilla.javascript.UniqueTag; //导入依赖的package包/类
private String processTemplate(String template, NodeRef templateRef, ScriptableObject args)
{
Object person = (Object)scope.get("person", scope);
Object companyhome = (Object)scope.get("companyhome", scope);
Object userhome = (Object)scope.get("userhome", scope);
// build default model for the template processing
Map<String, Object> model = this.services.getTemplateService().buildDefaultModel(
(person.equals(UniqueTag.NOT_FOUND)) ? null : ((ScriptNode)((Wrapper)person).unwrap()).getNodeRef(),
(companyhome.equals(UniqueTag.NOT_FOUND)) ? null : ((ScriptNode)((Wrapper)companyhome).unwrap()).getNodeRef(),
(userhome.equals(UniqueTag.NOT_FOUND)) ? null : ((ScriptNode)((Wrapper)userhome).unwrap()).getNodeRef(),
templateRef,
null);
// add the current node as either the document/space as appropriate
if (this.getIsDocument())
{
model.put("document", this.nodeRef);
model.put("space", getPrimaryParentAssoc().getParentRef());
}
else
{
model.put("space", this.nodeRef);
}
// add the supplied args to the 'args' root object
if (args != null)
{
// we need to get all the keys to the properties provided
// and convert them to a Map of QName to Serializable objects
Object[] propIds = args.getIds();
Map<String, String> templateArgs = new HashMap<String, String>(propIds.length);
for (int i = 0; i < propIds.length; i++)
{
// work on each key in turn
Object propId = propIds[i];
// we are only interested in keys that are formed of Strings i.e. QName.toString()
if (propId instanceof String)
{
// get the value out for the specified key - make sure it is Serializable
Object value = args.get((String) propId, args);
value = getValueConverter().convertValueForRepo((Serializable)value);
if (value != null)
{
templateArgs.put((String) propId, value.toString());
}
}
}
// add the args to the model as the 'args' root object
model.put("args", templateArgs);
}
// execute template!
// TODO: check that script modified nodes are reflected...
return this.services.getTemplateService().processTemplateString(null, template, model);
}