public class NameMetamethodValueTypeNamer extends Object implements org.classdump.luna.ValueTypeNamer
The namer first tries to find the key "__name" (see BasicLib.MT_NAME)
in the object's metatable. If a value with such key exists and is a string, it is
used as the type name. Otherwise, light userdata is assigned the type name
"light userdata" (BasicLib.TYPENAME_LIGHT_USERDATA), and the rest is
assigned the same name as assigned by PlainValueTypeNamer.
| Constructor and Description |
|---|
NameMetamethodValueTypeNamer(org.classdump.luna.MetatableProvider metatableProvider)
Creates a new instance of this value type namer that uses the supplied
metatable provider
metatableProvider for looking up type names. |
| Modifier and Type | Method and Description |
|---|---|
org.classdump.luna.ByteString |
typeNameOf(Object instance) |
static org.classdump.luna.ByteString |
typeNameOf(Object instance,
org.classdump.luna.MetatableProvider metatableProvider)
Returns the type name (a string) of the given value
instance, using
metatableProvider to look up the the name in the "__name" field
of instance's metatable, if it is defined. |
public NameMetamethodValueTypeNamer(org.classdump.luna.MetatableProvider metatableProvider)
metatableProvider for looking up type names.metatableProvider - the metatable provider, must not be nullNullPointerException - if metatableProvider is nullpublic static org.classdump.luna.ByteString typeNameOf(Object instance, org.classdump.luna.MetatableProvider metatableProvider)
instance, using
metatableProvider to look up the the name in the "__name" field
of instance's metatable, if it is defined.instance - the object instance, may be nullmetatableProvider - the metatable provider, must not be nullinstanceNullPointerException - if metatableProvider is nullpublic org.classdump.luna.ByteString typeNameOf(Object instance)
typeNameOf in interface org.classdump.luna.ValueTypeNamerCopyright © 2016–2017. All rights reserved.