org.rythmengine
Class _Rythm

java.lang.Object
  extended by org.rythmengine._Rythm

public class _Rythm
extends Object

_Rythm is clone of Rythm but for internal use of Rythm engine. User application shall NOT use _Rythm


Constructor Summary
_Rythm()
           
 
Method Summary
static String commonsToString(Object obj, ToStringOption option, org.apache.commons.lang3.builder.ToStringStyle style)
           
static RythmEngine engine()
          Return the default engine.
static Object eval(String s)
           
static void init()
          Initialize default engine instance with default configuration.
static void init(File file)
          Initialize default engine instance with specified configuration file

static void init(Map<String,?> conf)
          Initialize default engine instance with specified configuration

static void init(RythmEngine engine)
          Use an pre-initialized engine as the default engine.
static boolean insideSandbox()
           
 boolean isProdMode()
          Check if default engine is running in production mode
static String render(File file, Object... args)
           
static String render(String template, Object... args)
           
static String renderIfTemplateExists(String template, Object... args)
           
static String renderStr(String template, Object... args)
          Alias of renderString(String, Object...)
static String renderString(String template, Object... args)
           
static Sandbox sandbox()
           
static void shutdown()
           
static String substitute(File template, Object... args)
           
static String substitute(String template, Object... args)
           
static String toString(Object obj)
           
static String toString(Object obj, ToStringOption option, ToStringStyle style)
           
static String toString(String template, Object obj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

_Rythm

public _Rythm()
Method Detail

init

public static void init(Map<String,?> conf)
Initialize default engine instance with specified configuration

Note this method can not be called more than once during a JVM lifecycle. if the default engine instance is created already then an IllegalStateException will be thrown out

When the default engine's shutdown method get called the default engine instance will be discard. Calling any servicing method of Rythm will cause an new RythmEngine initialized as the new default engine

Parameters:
conf - the configurations

init

public static void init(File file)
Initialize default engine instance with specified configuration file

Note this method can not be called more than once during a JVM lifecycle. if the default engine instance is created already then an IllegalStateException will be thrown out

When the default engine's shutdown method get called the default engine instance will be discard. Calling any servicing method of Rythm will cause an new RythmEngine initialized as the new default engine

Parameters:
file - the configuration file

init

public static void init()
Initialize default engine instance with default configuration.

Just like init(java.util.Map) method, this method cannot be called more than once

Note this default engine instance will be implicitly initialized with the default configuration if render or the lazy load engine() methods are called before calling any init methods


init

public static void init(RythmEngine engine)
Use an pre-initialized engine as the default engine. Note if there are already default engine initialized then the method will raise a IllegalStateException

When the default engine's shutdown method get called the default engine instance will be discard. Calling any servicing method of Rythm will cause an new RythmEngine initialized as the new default engine

Parameters:
engine -

engine

public static RythmEngine engine()
Return the default engine. If the default engine is not initialized yet, then initialize it and then return

Returns:
default engine

insideSandbox

public static boolean insideSandbox()
Returns:
true if the current thread is in sandbox mode
See Also:
RythmEngine.insideSandbox()

sandbox

public static Sandbox sandbox()
Returns:
an new sandbox
See Also:
RythmEngine.sandbox()

isProdMode

public boolean isProdMode()
Check if default engine is running in production mode

Returns:
true if default engine is in prod mode

render

public static String render(String template,
                            Object... args)
Parameters:
template -
args -
Returns:
render result
See Also:
RythmEngine.render(String, Object...)

render

public static String render(File file,
                            Object... args)
Parameters:
file -
args -
Returns:
render result
See Also:
RythmEngine.render(java.io.File, Object...)

substitute

public static String substitute(String template,
                                Object... args)
Parameters:
template -
args -
Returns:
render result
See Also:
RythmEngine.substitute(String, Object...)

substitute

public static String substitute(File template,
                                Object... args)
Parameters:
template -
args -
Returns:
render result
See Also:
RythmEngine.substitute(java.io.File, Object...)

toString

public static String toString(String template,
                              Object obj)
Parameters:
template -
obj -
Returns:
render result
See Also:
RythmEngine.toString(String, Object)

toString

public static String toString(Object obj)
Parameters:
obj -
Returns:
render result
See Also:
RythmEngine.toString(Object)

toString

public static String toString(Object obj,
                              ToStringOption option,
                              ToStringStyle style)
Parameters:
obj -
option -
style -
Returns:
render result
See Also:
RythmEngine.toString(Object, org.rythmengine.toString.ToStringOption, org.rythmengine.toString.ToStringStyle)

commonsToString

public static String commonsToString(Object obj,
                                     ToStringOption option,
                                     org.apache.commons.lang3.builder.ToStringStyle style)
Parameters:
obj -
option -
style -
Returns:
render result
See Also:
RythmEngine.commonsToString(Object, org.rythmengine.toString.ToStringOption, org.apache.commons.lang3.builder.ToStringStyle)

renderStr

public static String renderStr(String template,
                               Object... args)
Alias of renderString(String, Object...)

Parameters:
template -
args -
Returns:
render result
See Also:
RythmEngine.renderString(String, Object...)

renderString

public static String renderString(String template,
                                  Object... args)
Parameters:
template -
args -
Returns:
render result
See Also:
RythmEngine.renderString(String, Object...)

renderIfTemplateExists

public static String renderIfTemplateExists(String template,
                                            Object... args)
Parameters:
template -
args -
Returns:
render result
See Also:
RythmEngine.renderIfTemplateExists(String, Object...)

eval

public static Object eval(String s)
Parameters:
s -
Returns:
evaluation result

shutdown

public static void shutdown()
See Also:
RythmEngine.shutdown()


Copyright © 2013. All Rights Reserved.