sdr 0.7

net.cscott.sdr.calls
Class FormationListJS

java.lang.Object
  extended by net.cscott.sdr.calls.FormationListJS
All Implemented Interfaces:
org.mozilla.javascript.Scriptable

public class FormationListJS
extends Object
implements org.mozilla.javascript.Scriptable

Javascript thunk to work around problem using Rhino to peer at FormationListFast/FormationListSlow via reflection. Since these are package-scope classes, Java's access control policy for security doesn't let us look at these fields, even if they are exported from the public FormationList. However, code within the same package can look at them via reflection. Thus this thunk class can take the place of FormationList and does the necessary reflection within package scope to avoid the access exceptions.

Tests:
js> FormationList = FormationListJS.initJS(this);
[object FormationListJS]
js> FormationList.SINGLE_DANCER
net.cscott.sdr.calls.NamedTaggedFormation[
  name=SINGLE DANCER
  location={<phantom@7b>=0,0,n}
  selected=[<phantom@7b>]
  tags={}
]
js> FormationList.all.size() > 0
true

Field Summary
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
FormationListJS(Class<?> formationList)
           
 
Method Summary
 void delete(int index)
           
 void delete(String name)
           
 Object get(int index, org.mozilla.javascript.Scriptable start)
           
 Object get(String name, org.mozilla.javascript.Scriptable start)
           
 String getClassName()
           
 Object getDefaultValue(Class<?> arg0)
           
 Object[] getIds()
           
 org.mozilla.javascript.Scriptable getParentScope()
           
 org.mozilla.javascript.Scriptable getPrototype()
           
 boolean has(int index, org.mozilla.javascript.Scriptable start)
           
 boolean has(String name, org.mozilla.javascript.Scriptable start)
           
 boolean hasInstance(org.mozilla.javascript.Scriptable instance)
           
static org.mozilla.javascript.Scriptable initJS(org.mozilla.javascript.Scriptable scope)
           
static org.mozilla.javascript.Scriptable initJS(org.mozilla.javascript.Scriptable scope, Class<?> formationList)
           
 void put(int index, org.mozilla.javascript.Scriptable start, Object value)
           
 void put(String name, org.mozilla.javascript.Scriptable start, Object value)
           
 void setParentScope(org.mozilla.javascript.Scriptable m)
           
 void setPrototype(org.mozilla.javascript.Scriptable m)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormationListJS

public FormationListJS(Class<?> formationList)
Method Detail

delete

public void delete(String name)
Specified by:
delete in interface org.mozilla.javascript.Scriptable

delete

public void delete(int index)
Specified by:
delete in interface org.mozilla.javascript.Scriptable

put

public void put(String name,
                org.mozilla.javascript.Scriptable start,
                Object value)
Specified by:
put in interface org.mozilla.javascript.Scriptable

put

public void put(int index,
                org.mozilla.javascript.Scriptable start,
                Object value)
Specified by:
put in interface org.mozilla.javascript.Scriptable

get

public Object get(String name,
                  org.mozilla.javascript.Scriptable start)
Specified by:
get in interface org.mozilla.javascript.Scriptable

get

public Object get(int index,
                  org.mozilla.javascript.Scriptable start)
Specified by:
get in interface org.mozilla.javascript.Scriptable

getClassName

public String getClassName()
Specified by:
getClassName in interface org.mozilla.javascript.Scriptable

getDefaultValue

public Object getDefaultValue(Class<?> arg0)
Specified by:
getDefaultValue in interface org.mozilla.javascript.Scriptable

getIds

public Object[] getIds()
Specified by:
getIds in interface org.mozilla.javascript.Scriptable

has

public boolean has(String name,
                   org.mozilla.javascript.Scriptable start)
Specified by:
has in interface org.mozilla.javascript.Scriptable

has

public boolean has(int index,
                   org.mozilla.javascript.Scriptable start)
Specified by:
has in interface org.mozilla.javascript.Scriptable

hasInstance

public boolean hasInstance(org.mozilla.javascript.Scriptable instance)
Specified by:
hasInstance in interface org.mozilla.javascript.Scriptable

getParentScope

public org.mozilla.javascript.Scriptable getParentScope()
Specified by:
getParentScope in interface org.mozilla.javascript.Scriptable

setParentScope

public void setParentScope(org.mozilla.javascript.Scriptable m)
Specified by:
setParentScope in interface org.mozilla.javascript.Scriptable

getPrototype

public org.mozilla.javascript.Scriptable getPrototype()
Specified by:
getPrototype in interface org.mozilla.javascript.Scriptable

setPrototype

public void setPrototype(org.mozilla.javascript.Scriptable m)
Specified by:
setPrototype in interface org.mozilla.javascript.Scriptable

initJS

public static org.mozilla.javascript.Scriptable initJS(org.mozilla.javascript.Scriptable scope)

initJS

public static org.mozilla.javascript.Scriptable initJS(org.mozilla.javascript.Scriptable scope,
                                                       Class<?> formationList)

sdr 0.7

Copyright © 2006-2009 C. Scott Ananian