本文整理了Java中org.mozilla.javascript.ScriptableObject.getAssociatedValue()
方法的一些代码示例,展示了ScriptableObject.getAssociatedValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScriptableObject.getAssociatedValue()
方法的具体详情如下:
包路径:org.mozilla.javascript.ScriptableObject
类名称:ScriptableObject
方法名:getAssociatedValue
[英]Get arbitrary application-specific value associated with this object.
[中]获取与此对象关联的任意特定于应用程序的值。
代码示例来源:origin: geogebra/geogebra
public static XMLLib extractFromScopeOrNull(Scriptable scope)
{
ScriptableObject so = ScriptRuntime.getLibraryScopeOrNull(scope);
if (so == null) {
// If library is not yet initialized, return null
return null;
}
// Ensure lazily initialization of real XML library instance
// which is done on first access to XML property
ScriptableObject.getProperty(so, "XML");
return (XMLLib)so.getAssociatedValue(XML_LIB_KEY);
}
代码示例来源:origin: rhino/js
public static XMLLib extractFromScopeOrNull(Scriptable scope)
{
ScriptableObject so = ScriptRuntime.getLibraryScopeOrNull(scope);
if (so == null) {
// If library is not yet initialized, return null
return null;
}
// Ensure lazily initialization of real XML library instance
// which is done on first access to XML property
ScriptableObject.getProperty(so, "XML");
return (XMLLib)so.getAssociatedValue(XML_LIB_KEY);
}
代码示例来源:origin: io.apigee/rhino
public static XMLLib extractFromScopeOrNull(Scriptable scope)
{
ScriptableObject so = ScriptRuntime.getLibraryScopeOrNull(scope);
if (so == null) {
// If library is not yet initialized, return null
return null;
}
// Ensure lazily initialization of real XML library instance
// which is done on first access to XML property
ScriptableObject.getProperty(so, "XML");
return (XMLLib)so.getAssociatedValue(XML_LIB_KEY);
}
代码示例来源:origin: ro.isdc.wro4j/rhino
public static XMLLib extractFromScopeOrNull(Scriptable scope)
{
ScriptableObject so = ScriptRuntime.getLibraryScopeOrNull(scope);
if (so == null) {
// If library is not yet initialized, return null
return null;
}
// Ensure lazily initialization of real XML library instance
// which is done on first access to XML property
ScriptableObject.getProperty(so, "XML");
return (XMLLib)so.getAssociatedValue(XML_LIB_KEY);
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
public static XMLLib extractFromScopeOrNull(Scriptable scope)
{
ScriptableObject so = ScriptRuntime.getLibraryScopeOrNull(scope);
if (so == null) {
// If librray is not yet initialized, return null
return null;
}
// Ensure lazily initialization of real XML library instance
// which is done on first access to XML property
ScriptableObject.getProperty(so, "XML");
return (XMLLib)so.getAssociatedValue(XML_LIB_KEY);
}
代码示例来源:origin: com.github.tntim96/rhino
public static XMLLib extractFromScopeOrNull(Scriptable scope)
{
ScriptableObject so = ScriptRuntime.getLibraryScopeOrNull(scope);
if (so == null) {
// If library is not yet initialized, return null
return null;
}
// Ensure lazily initialization of real XML library instance
// which is done on first access to XML property
ScriptableObject.getProperty(so, "XML");
return (XMLLib)so.getAssociatedValue(XML_LIB_KEY);
}
代码示例来源:origin: rhino/js
/**
* Get arbitrary application-specific value associated with the top scope
* of the given scope.
* The method first calls {@link #getTopLevelScope(Scriptable scope)}
* and then searches the prototype chain of the top scope for the first
* object containing the associated value with the given key.
*
* @param scope the starting scope.
* @param key key object to select particular value.
* @see #getAssociatedValue(Object key)
*/
public static Object getTopScopeValue(Scriptable scope, Object key)
{
scope = ScriptableObject.getTopLevelScope(scope);
for (;;) {
if (scope instanceof ScriptableObject) {
ScriptableObject so = (ScriptableObject)scope;
Object value = so.getAssociatedValue(key);
if (value != null) {
return value;
}
}
scope = scope.getPrototype();
if (scope == null) {
return null;
}
}
}
代码示例来源:origin: geogebra/geogebra
/**
* Get arbitrary application-specific value associated with the top scope
* of the given scope.
* The method first calls {@link #getTopLevelScope(Scriptable scope)}
* and then searches the prototype chain of the top scope for the first
* object containing the associated value with the given key.
*
* @param scope the starting scope.
* @param key key object to select particular value.
* @see #getAssociatedValue(Object key)
*/
public static Object getTopScopeValue(Scriptable scope, Object key)
{
scope = ScriptableObject.getTopLevelScope(scope);
for (;;) {
if (scope instanceof ScriptableObject) {
ScriptableObject so = (ScriptableObject)scope;
Object value = so.getAssociatedValue(key);
if (value != null) {
return value;
}
}
scope = scope.getPrototype();
if (scope == null) {
return null;
}
}
}
代码示例来源:origin: ro.isdc.wro4j/rhino
/**
* Get arbitrary application-specific value associated with the top scope
* of the given scope.
* The method first calls {@link #getTopLevelScope(Scriptable scope)}
* and then searches the prototype chain of the top scope for the first
* object containing the associated value with the given key.
*
* @param scope the starting scope.
* @param key key object to select particular value.
* @see #getAssociatedValue(Object key)
*/
public static Object getTopScopeValue(Scriptable scope, Object key)
{
scope = ScriptableObject.getTopLevelScope(scope);
for (;;) {
if (scope instanceof ScriptableObject) {
ScriptableObject so = (ScriptableObject)scope;
Object value = so.getAssociatedValue(key);
if (value != null) {
return value;
}
}
scope = scope.getPrototype();
if (scope == null) {
return null;
}
}
}
代码示例来源:origin: com.github.tntim96/rhino
/**
* Get arbitrary application-specific value associated with the top scope
* of the given scope.
* The method first calls {@link #getTopLevelScope(Scriptable scope)}
* and then searches the prototype chain of the top scope for the first
* object containing the associated value with the given key.
*
* @param scope the starting scope.
* @param key key object to select particular value.
* @see #getAssociatedValue(Object key)
*/
public static Object getTopScopeValue(Scriptable scope, Object key)
{
scope = ScriptableObject.getTopLevelScope(scope);
for (;;) {
if (scope instanceof ScriptableObject) {
ScriptableObject so = (ScriptableObject)scope;
Object value = so.getAssociatedValue(key);
if (value != null) {
return value;
}
}
scope = scope.getPrototype();
if (scope == null) {
return null;
}
}
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
/**
* Get arbitrary application-specific value associated with the top scope
* of the given scope.
* The method first calls {@link #getTopLevelScope(Scriptable scope)}
* and then searches the prototype chain of the top scope for the first
* object containing the associated value with the given key.
*
* @param scope the starting scope.
* @param key key object to select particular value.
* @see #getAssociatedValue(Object key)
*/
public static Object getTopScopeValue(Scriptable scope, Object key)
{
scope = ScriptableObject.getTopLevelScope(scope);
for (;;) {
if (scope instanceof ScriptableObject) {
ScriptableObject so = (ScriptableObject)scope;
Object value = so.getAssociatedValue(key);
if (value != null) {
return value;
}
}
scope = scope.getPrototype();
if (scope == null) {
return null;
}
}
}
代码示例来源:origin: io.apigee/rhino
/**
* Get arbitrary application-specific value associated with the top scope
* of the given scope.
* The method first calls {@link #getTopLevelScope(Scriptable scope)}
* and then searches the prototype chain of the top scope for the first
* object containing the associated value with the given key.
*
* @param scope the starting scope.
* @param key key object to select particular value.
* @see #getAssociatedValue(Object key)
*/
public static Object getTopScopeValue(Scriptable scope, Object key)
{
scope = ScriptableObject.getTopLevelScope(scope);
for (;;) {
if (scope instanceof ScriptableObject) {
ScriptableObject so = (ScriptableObject)scope;
Object value = so.getAssociatedValue(key);
if (value != null) {
return value;
}
}
scope = scope.getPrototype();
if (scope == null) {
return null;
}
}
}
代码示例来源:origin: geogebra/geogebra
protected static Object createInterfaceAdapter(Class<?>type, ScriptableObject so) {
// XXX: Currently only instances of ScriptableObject are
// supported since the resulting interface proxies should
// be reused next time conversion is made and generic
// Callable has no storage for it. Weak references can
// address it but for now use this restriction.
Object key = Kit.makeHashKeyFromPair(COERCED_INTERFACE_KEY, type);
Object old = so.getAssociatedValue(key);
if (old != null) {
// Function was already wrapped
return old;
}
Context cx = Context.getContext();
Object glue = InterfaceAdapter.create(cx, type, so);
// Store for later retrieval
glue = so.associateValue(key, glue);
return glue;
}
代码示例来源:origin: io.apigee/rhino
protected static Object createInterfaceAdapter(Class<?>type, ScriptableObject so) {
// XXX: Currently only instances of ScriptableObject are
// supported since the resulting interface proxies should
// be reused next time conversion is made and generic
// Callable has no storage for it. Weak references can
// address it but for now use this restriction.
Object key = Kit.makeHashKeyFromPair(COERCED_INTERFACE_KEY, type);
Object old = so.getAssociatedValue(key);
if (old != null) {
// Function was already wrapped
return old;
}
Context cx = Context.getContext();
Object glue = InterfaceAdapter.create(cx, type, so);
// Store for later retrieval
glue = so.associateValue(key, glue);
return glue;
}
代码示例来源:origin: ro.isdc.wro4j/rhino
protected static Object createInterfaceAdapter(Class<?>type, ScriptableObject so) {
// XXX: Currently only instances of ScriptableObject are
// supported since the resulting interface proxies should
// be reused next time conversion is made and generic
// Callable has no storage for it. Weak references can
// address it but for now use this restriction.
Object key = Kit.makeHashKeyFromPair(COERCED_INTERFACE_KEY, type);
Object old = so.getAssociatedValue(key);
if (old != null) {
// Function was already wrapped
return old;
}
Context cx = Context.getContext();
Object glue = InterfaceAdapter.create(cx, type, so);
// Store for later retrieval
glue = so.associateValue(key, glue);
return glue;
}
代码示例来源:origin: com.github.tntim96/rhino
protected static Object createInterfaceAdapter(Class<?>type, ScriptableObject so) {
// XXX: Currently only instances of ScriptableObject are
// supported since the resulting interface proxies should
// be reused next time conversion is made and generic
// Callable has no storage for it. Weak references can
// address it but for now use this restriction.
Object key = Kit.makeHashKeyFromPair(COERCED_INTERFACE_KEY, type);
Object old = so.getAssociatedValue(key);
if (old != null) {
// Function was already wrapped
return old;
}
Context cx = Context.getContext();
Object glue = InterfaceAdapter.create(cx, type, so);
// Store for later retrieval
glue = so.associateValue(key, glue);
return glue;
}
代码示例来源:origin: io.apigee.trireme/trireme-util
XmlWrapImpl self = (XmlWrapImpl)thisObj;
Templates tmpl = (Templates)ss.getAssociatedValue("template");
if (tmpl == null) {
throw Utils.makeError(cx, thisObj, "Stylesheet was not created by createStylesheet");
Source src = (Source)doc.getAssociatedValue("document");
if (src == null) {
throw Utils.makeError(cx, thisObj, "Document was not created by createDocument");
代码示例来源:origin: rhino/js
Object key = Kit.makeHashKeyFromPair(
COERCED_INTERFACE_KEY, type);
Object old = so.getAssociatedValue(key);
if (old != null) {
代码示例来源:origin: com.sun.phobos/phobos-rhino
Object key = Kit.makeHashKeyFromPair(
COERCED_INTERFACE_KEY, type);
Object old = so.getAssociatedValue(key);
if (old != null) {
内容来源于网络,如有侵权,请联系作者删除!