|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.javascript.rhino.Kit
public class Kit
Collection of utilities
Constructor Summary | |
---|---|
Kit()
|
Method Summary | |
---|---|
static Object |
addListener(Object bag,
Object listener)
Add listener to bag of listeners. |
static Class<?> |
classOrNull(ClassLoader loader,
String className)
|
static Class<?> |
classOrNull(String className)
|
static RuntimeException |
codeBug()
Throws RuntimeException to indicate failed assertion. |
static Object |
getListener(Object bag,
int index)
Get listener at index position in bag or null if index equals to number of listeners in bag. |
static RuntimeException |
initCause(RuntimeException ex,
Throwable cause)
If initCause methods exists in Throwable, call ex.initCause(cause) or otherwise do nothing. |
static Object |
makeHashKeyFromPair(Object key1,
Object key2)
|
static String |
readReader(Reader r)
|
static byte[] |
readStream(InputStream is,
int initialBufferCapacity)
|
static Object |
removeListener(Object bag,
Object listener)
Remove listener from bag of listeners. |
static String[] |
semicolonSplit(String s)
Split string into array of strings using semicolon as string terminator (; after the last string is required). |
static int |
xDigitToInt(int c,
int accumulator)
If character c is a hexadecimal digit, return accumulator * 16 plus corresponding number. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Kit()
Method Detail |
---|
public static Class<?> classOrNull(String className)
public static Class<?> classOrNull(ClassLoader loader, String className)
public static RuntimeException initCause(RuntimeException ex, Throwable cause)
public static String[] semicolonSplit(String s)
public static int xDigitToInt(int c, int accumulator)
public static Object addListener(Object bag, Object listener)
Usage example:
private volatile Object changeListeners; public void addMyListener(PropertyChangeListener l) { synchronized (this) { changeListeners = Kit.addListener(changeListeners, l); } } public void removeTextListener(PropertyChangeListener l) { synchronized (this) { changeListeners = Kit.removeListener(changeListeners, l); } } public void fireChangeEvent(Object oldValue, Object newValue) { // Get immune local copy Object listeners = changeListeners; if (listeners != null) { PropertyChangeEvent e = new PropertyChangeEvent( this, "someProperty" oldValue, newValue); for (int i = 0; ; ++i) { Object l = Kit.getListener(listeners, i); if (l == null) break; ((PropertyChangeListener)l).propertyChange(e); } } }
listener
- Listener to add to bagbag
- Current collection of listeners.
removeListener(Object bag, Object listener)
,
getListener(Object bag, int index)
public static Object removeListener(Object bag, Object listener)
For usage example, see addListener(Object bag, Object listener)
.
listener
- Listener to remove from bagbag
- Current collection of listeners.
addListener(Object bag, Object listener)
,
getListener(Object bag, int index)
public static Object getListener(Object bag, int index)
For usage example, see addListener(Object bag, Object listener)
.
bag
- Current collection of listeners.index
- Index of the listener to access.
addListener(Object bag, Object listener)
,
removeListener(Object bag, Object listener)
public static Object makeHashKeyFromPair(Object key1, Object key2)
public static String readReader(Reader r) throws IOException
IOException
public static byte[] readStream(InputStream is, int initialBufferCapacity) throws IOException
IOException
public static RuntimeException codeBug() throws RuntimeException
RuntimeException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |