public abstract class AbstractStateContext extends Object implements StateContext
Modifier | Constructor and Description |
---|---|
protected |
AbstractStateContext(StateContext stateContext)
Constructs a new
AbstractStateContext that delegates to the specified
state context stateContext . |
protected |
AbstractStateContext(TableFactory tableFactory,
MetatableAccessor metatableAccessor)
Constructs a new
AbstractStateContext with the specified table factory
and metatable accessor. |
Modifier and Type | Method and Description |
---|---|
Table |
getBooleanMetatable()
Returns the metatable for
boolean values, or null if this provider does
not assign a metatable to the boolean type. |
Table |
getFunctionMetatable()
Returns the metatable for
function values, or null if this provider does
not assign a metatable to the function type. |
Table |
getLightUserdataMetatable()
Returns the metatable for light userdata, or
null if this provider does
not assign a metatable to light userdata.. |
Table |
getMetatable(Object instance)
Returns the metatable for the object
instance , or null if this
metatable provider does not assign any metatable to instance . |
Table |
getNilMetatable()
Returns the metatable for nil (the
nil type), or null if this
provider does not assign a metatable to the nil type. |
Table |
getNumberMetatable()
Returns the metatable for
number values, or null if this provider does
not assign a metatable to the number type. |
Table |
getStringMetatable()
Returns the metatable for
string values, or null if this provider does
not assign a metatable to the string type. |
Table |
getThreadMetatable()
Returns the metatable for
thread values, or null if this provider does
not assign a metatable to the thread type. |
Table |
newTable()
Creates a new empty table.
|
Table |
newTable(int array,
int hash)
Creates a new empty table with the given initial capacities for its array and hash
parts.
|
Table |
setBooleanMetatable(Table table)
Sets the metatable for the
boolean type. |
Table |
setFunctionMetatable(Table table)
Sets the metatable for the
function type. |
Table |
setLightUserdataMetatable(Table table)
Sets the metatable for light userdata.
|
Table |
setMetatable(Object instance,
Table table)
Sets the metatable of the object
instance to table . |
Table |
setNilMetatable(Table table)
Sets the metatable for nil (i.e., the
nil type) to table . |
Table |
setNumberMetatable(Table table)
Sets the metatable for the
number type. |
Table |
setStringMetatable(Table table)
Sets the metatable for the
string type. |
Table |
setThreadMetatable(Table table)
Sets the metatable for the
thread type. |
protected AbstractStateContext(TableFactory tableFactory, MetatableAccessor metatableAccessor)
AbstractStateContext
with the specified table factory
and metatable accessor.tableFactory
- the table factory, must not be null
metatableAccessor
- the metatable accessor, must not be null
NullPointerException
- if tableFactory
or metatableAccessor
is null
protected AbstractStateContext(StateContext stateContext)
AbstractStateContext
that delegates to the specified
state context stateContext
.stateContext
- the state context, must not be null
NullPointerException
- if stateContext
is null
public Table getMetatable(Object instance)
MetatableProvider
instance
, or null
if this
metatable provider does not assign any metatable to instance
.getMetatable
in interface MetatableProvider
instance
- the object to obtain a metatable for, may be null
instance
, or null
if there is no metatable
assigned to instance
in this providerpublic Table getNilMetatable()
MetatableProvider
nil
type), or null
if this
provider does not assign a metatable to the nil
type.getNilMetatable
in interface MetatableProvider
nil
typepublic Table getBooleanMetatable()
MetatableProvider
boolean
values, or null
if this provider does
not assign a metatable to the boolean
type.getBooleanMetatable
in interface MetatableProvider
boolean
typepublic Table getNumberMetatable()
MetatableProvider
number
values, or null
if this provider does
not assign a metatable to the number
type.getNumberMetatable
in interface MetatableProvider
number
typepublic Table getStringMetatable()
MetatableProvider
string
values, or null
if this provider does
not assign a metatable to the string
type.getStringMetatable
in interface MetatableProvider
string
typepublic Table getFunctionMetatable()
MetatableProvider
function
values, or null
if this provider does
not assign a metatable to the function
type.getFunctionMetatable
in interface MetatableProvider
function
typepublic Table getThreadMetatable()
MetatableProvider
thread
values, or null
if this provider does
not assign a metatable to the thread
type.getThreadMetatable
in interface MetatableProvider
thread
typepublic Table getLightUserdataMetatable()
MetatableProvider
null
if this provider does
not assign a metatable to light userdata..getLightUserdataMetatable
in interface MetatableProvider
public Table setMetatable(Object instance, Table table)
MetatableAccessor
instance
to table
.
table
may be null
: in that case, clears instance
's metatable.
Returns the previous metatable.
Note that instance
may share the metatable with other instances of the same
(Lua) type. This method provides a uniform interface for setting the metatables
of all types.
setMetatable
in interface MetatableAccessor
instance
- object to set the metatable of, may be null
table
- new metatable of instance
, may be null
instance
public Table setNilMetatable(Table table)
MetatableAccessor
nil
type) to table
.
table
may be null
: in that case, clears the metatable. Returns
the previous metatable.setNilMetatable
in interface MetatableAccessor
table
- new metatable for the nil
type, may be null
nil
typepublic Table setBooleanMetatable(Table table)
MetatableAccessor
boolean
type.
table
may be null
: in that case, clears the metatable. Returns
the previous metatable.setBooleanMetatable
in interface MetatableAccessor
table
- new metatable for the boolean
type, may be null
boolean
typepublic Table setNumberMetatable(Table table)
MetatableAccessor
number
type.
table
may be null
: in that case, clears the metatable. Returns
the previous metatable.setNumberMetatable
in interface MetatableAccessor
table
- new metatable for the number
type, may be null
number
typepublic Table setStringMetatable(Table table)
MetatableAccessor
string
type.
table
may be null
: in that case, clears the metatable. Returns
the previous metatable.setStringMetatable
in interface MetatableAccessor
table
- new metatable for the string
type, may be null
string
typepublic Table setFunctionMetatable(Table table)
MetatableAccessor
function
type.
table
may be null
: in that case, clears the metatable. Returns
the previous metatable.setFunctionMetatable
in interface MetatableAccessor
table
- new metatable for the function
type, may be null
function
typepublic Table setThreadMetatable(Table table)
MetatableAccessor
thread
type.
table
may be null
: in that case, clears the metatable. Returns
the previous metatable.setThreadMetatable
in interface MetatableAccessor
table
- new metatable for the thread
type, may be null
thread
typepublic Table setLightUserdataMetatable(Table table)
MetatableAccessor
table
may be null
: in that case, clears the metatable. Returns
the previous metatable.setLightUserdataMetatable
in interface MetatableAccessor
table
- new metatable for light userdata, may be null
public Table newTable()
TableFactory
newTable(0, 0)
.newTable
in interface TableFactory
TableFactory.newTable(int, int)
public Table newTable(int array, int hash)
TableFactory
newTable
in interface TableFactory
array
- initial capacity for the array parthash
- initial capacity for the hash partCopyright © 2016. All rights reserved.