Javolution 6.0.0 java
|
Public Member Functions | |
TextContextImpl () | |
TextContextImpl (TextContextImpl parent) | |
void | exit () |
Static Public Member Functions | |
static TextContext | enter () |
static< T extends AbstractContext > T | enter (Class< T > custom) |
static< T > TextFormat< T > | getFormat (Class<? extends T > type) |
static AbstractContext | current () |
static void | inherit (AbstractContext ctx) |
Protected Member Functions | |
TextContext | inner () |
AbstractContext | enterInner () |
AbstractContext | getOuter () |
Static Protected Member Functions | |
static< T extends AbstractContext > T | current (Class< T > type) |
Package Functions | |
protected< T > TextFormat< T > | searchFormat (Class<? extends T > type) |
public< T > void | setFormat (Class<? extends T > type, TextFormat< T > format) |
Private Member Functions | |
void | storePrimitiveTypesFormats () |
Static Private Member Functions | |
static TextContext | currentTextContext () |
Private Attributes | |
final FastMap< Class<?>, TextFormat<?> > | localFormats |
final FastMap< Class<?>, TextFormat<?> > | defaultFormats |
AbstractContext | outer |
Static Private Attributes | |
static final TextFormat<?> | OBJECT_FORMAT |
static final ThreadLocal< AbstractContext > | CURRENT = new ThreadLocal<AbstractContext>() |
Holds the default implementation of TextContext.
Definition at line 37 of file TextContextImpl.java.
javolution.text.internal.TextContextImpl.TextContextImpl | ( | ) |
Default constructor for root
Definition at line 70 of file TextContextImpl.java.
References javolution.text.internal.TextContextImpl.defaultFormats, javolution.text.internal.TextContextImpl.localFormats, and javolution.text.internal.TextContextImpl.storePrimitiveTypesFormats().
Referenced by javolution.text.internal.TextContextImpl.inner().
javolution.text.internal.TextContextImpl.TextContextImpl | ( | TextContextImpl | parent | ) |
Inner constructor
Definition at line 77 of file TextContextImpl.java.
References javolution.text.internal.TextContextImpl.defaultFormats, and javolution.text.internal.TextContextImpl.localFormats.
|
staticinherited |
Returns the current context for the current thread or
if this thread has no context (default).
Definition at line 61 of file AbstractContext.java.
References javolution.context.AbstractContext.CURRENT.
Referenced by javolution.context.LogContext.currentLogContext(), javolution.context.SecurityContext.currentSecurityContext(), javolution.text.TextContext.currentTextContext(), javolution.xml.XMLContext.currentXMLContext(), javolution.context.LocalContext.enter(), javolution.context.ConcurrentContext.enter(), and javolution.context.LocalContext.Parameter< T >.get().
|
staticprotectedinherited |
Returns the current context of specified type or
if none.
Definition at line 69 of file AbstractContext.java.
References javolution.context.AbstractContext.CURRENT, and javolution.context.AbstractContext.outer.
|
staticprivateinherited |
Returns the current text context.
Definition at line 87 of file TextContext.java.
References javolution.context.AbstractContext.current(), and javolution.osgi.internal.OSGiServices.getTextContext().
Referenced by javolution.text.TextContext.enter(), and javolution.text.TextContext.getFormat().
|
staticinherited |
Enters and returns a new text context instance.
Definition at line 59 of file TextContext.java.
References javolution.text.TextContext.currentTextContext(), and javolution.context.AbstractContext.enterInner().
|
staticinherited |
Enters the scope of a custom context. This method raises a SecurityException if the permission to enter contexts of the specified class is not granted. For example, the following disallow entering any custom context. [code] SecurityContext ctx = SecurityContext.enter(); try { ctx.revoke(new SecurityContext.Permission(AbstractContext.class, "enter")); ... // Cannot enter any custom context. } finally { ctx.exit(); // Back to previous security settings. }[/code]
custom | the custom context to enter. |
IllegalArgumentException | if the specified class default constructor cannot be instantiated. |
SecurityException | if SecurityContext.Permission(custom, "enter")
is not granted. |
Definition at line 101 of file AbstractContext.java.
References javolution.context.SecurityContext.check().
|
protectedinherited |
Enters the scope of an inner context which becomes the current context; the previous current context becomes the outer of this context.
Definition at line 141 of file AbstractContext.java.
References javolution.context.AbstractContext.CURRENT, and javolution.context.AbstractContext.outer.
Referenced by javolution.xml.XMLContext.enter(), javolution.text.TextContext.enter(), javolution.context.LogContext.enter(), javolution.context.LocalContext.enter(), javolution.context.SecurityContext.enter(), and javolution.context.ConcurrentContext.enter().
|
inherited |
Exits the scope of this context; the outer of this context becomes
the current context.
IllegalStateException | if this context is not the current context. |
Reimplemented in javolution.context.ConcurrentContext, and javolution.context.internal.ConcurrentContextImpl.
Definition at line 155 of file AbstractContext.java.
References javolution.context.AbstractContext.CURRENT.
|
staticinherited |
Returns the text format for the specified type. It is the most specialized format able to parse/format instances of the specified class. If there is no default format for the specified class, the standard object format (toString based) is returned.
Definition at line 69 of file TextContext.java.
References javolution.text.TextContext.currentTextContext(), and javolution.text.TextContext.searchFormat().
Referenced by javolution.text.TextBuilder.append(), javolution.util.FastCollection< E >.Format.format(), javolution.xml.XMLFormat< T >.InputElement.getAttribute(), javolution.xml.XMLFormat< T >.Default.newInstance(), javolution.lang.Configurable< javolution.context.LogContext.Level >.parse(), javolution.util.Index.toString(), javolution.util.FastMap< Object, javolution.util.Index >.toString(), javolution.util.FastCollection< E >.toString(), and javolution.xml.XMLFormat< T >.Default.write().
|
protectedinherited |
Returns the outer context of this context or
if this context has no outer context.
Definition at line 167 of file AbstractContext.java.
|
staticinherited |
Inherits the specified context which becomes the context of the current thread. This method is particularly useful when creating new threads to make them inherits from the context stack of the parent thread. [code] //Spawns a new thread inheriting the context of the current thread. MyThread myThread = new MyThread(); myThread.inherited = AbstractContext.current(); myThread.start(); ... class MyThread extends Thread { AbstractContext inherited; public void run() { AbstractContext.inherit(inherited); // Sets current context. ... } }[/code]
Definition at line 131 of file AbstractContext.java.
Referenced by javolution.context.internal.ConcurrentThreadImpl.run().
|
protected |
Returns a new inner instance of this context inheriting the properties of this context. The new instance can be configured independently from its parent.
Reimplemented from javolution.context.AbstractContext.
Definition at line 84 of file TextContextImpl.java.
References javolution.text.internal.TextContextImpl.TextContextImpl().
|
package |
Searches the most specialized format for the specified type.
Reimplemented from javolution.text.TextContext.
Definition at line 90 of file TextContextImpl.java.
References javolution.text.internal.TextContextImpl.defaultFormats, javolution.text.internal.TextContextImpl.localFormats, javolution.text.DefaultTextFormat.value(), and javolution.context.LogContext.warning().
|
package |
Sets the text format for the specified type (and its sub-types).
Reimplemented from javolution.text.TextContext.
Definition at line 129 of file TextContextImpl.java.
References javolution.text.internal.TextContextImpl.localFormats.
|
private |
Definition at line 137 of file TextContextImpl.java.
References javolution.text.internal.TextContextImpl.defaultFormats, javolution.text.internal.TextContextImpl.OBJECT_FORMAT, and javolution.text.TypeFormat.parseBoolean().
Referenced by javolution.text.internal.TextContextImpl.TextContextImpl().
|
staticprivateinherited |
Holds the last context entered (thread-local).
Definition at line 45 of file AbstractContext.java.
Referenced by javolution.context.AbstractContext.current(), javolution.context.AbstractContext.enterInner(), and javolution.context.AbstractContext.exit().
|
private |
Definition at line 67 of file TextContextImpl.java.
Referenced by javolution.text.internal.TextContextImpl.searchFormat(), javolution.text.internal.TextContextImpl.storePrimitiveTypesFormats(), and javolution.text.internal.TextContextImpl.TextContextImpl().
|
private |
Definition at line 64 of file TextContextImpl.java.
Referenced by javolution.text.internal.TextContextImpl.searchFormat(), javolution.text.internal.TextContextImpl.setFormat(), and javolution.text.internal.TextContextImpl.TextContextImpl().
|
staticprivate |
Definition at line 39 of file TextContextImpl.java.
Referenced by javolution.text.internal.TextContextImpl.storePrimitiveTypesFormats().
|
privateinherited |
Holds the outer context or
if none (top context).
Definition at line 50 of file AbstractContext.java.
Referenced by javolution.context.AbstractContext.current(), and javolution.context.AbstractContext.enterInner().