|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dynalang.mop.impl.StandardMetaobjectProtocolFactory
public class StandardMetaobjectProtocolFactory
A class with static utility methods for creating a "standard" MOP. A
standard MOP is a MOP that is a compositional of MOPs known and precreated
by the caller as well as any automatically discovered
MOPs.
Method Summary | |
---|---|
static MetaobjectProtocol[] |
createStandardFallback(boolean elementsShadowMethods,
boolean methodsEnumerable)
Creates "standard" fallback MOP sequence to use as the fallback parameter in createStandardMetaobjectProtocol(ClassLoader,
MetaobjectProtocol[], MetaobjectProtocol[]) . |
static MetaobjectProtocol |
createStandardMetaobjectProtocol(boolean elementsShadowMethods,
boolean methodsEnumerable)
This method implements the "usual" way for creation of a composite metaobject protocol instance that encompasses all available MOPs in the classpath of the current thread's class loader. |
static MetaobjectProtocol |
createStandardMetaobjectProtocol(java.lang.ClassLoader classLoader,
MetaobjectProtocol[] prioritized,
MetaobjectProtocol[] fallbacks)
This method implements the "usual" way for creation of a composite metaobject protocol instance that encompasses all available MOPs. |
static MetaobjectProtocol |
createStandardMetaobjectProtocol(MetaobjectProtocol nativeProtocol,
boolean elementsShadowMethods,
boolean methodsEnumerable)
This method implements the "usual" way for creation of a composite metaobject protocol instance that encompasses all available MOPs in the classpath of the current thread's class loader, adding a single metaobject protocol as the first MOP of the composite. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static MetaobjectProtocol createStandardMetaobjectProtocol(boolean elementsShadowMethods, boolean methodsEnumerable) throws java.io.IOException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException
elementsShadowMethods
- the order of fallback MOPs. If true, List
and Map MOP are put before the beans MOP. If false, beans MOP is put
before the List and Map MOP. Note that List and Map MOPs implement
ClassBasedMetaobjectProtocol
while beans MOP does not, so you'll
generally get better performance if you pass true for this parameter.methodsEnumerable
- if true, then objects' methods and JavaBeans
properties show up in the results of
BaseMetaobjectProtocol.properties(Object)
and
MetaobjectProtocol.propertyIds(Object)
. If false, these can
still be accessed by directly addressing them, but don't show up in
aforementioned methods' results.
java.io.IOException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
public static MetaobjectProtocol createStandardMetaobjectProtocol(MetaobjectProtocol nativeProtocol, boolean elementsShadowMethods, boolean methodsEnumerable) throws java.io.IOException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException
nativeProtocol
- the MOP for the environment's native objects (i.e.
a JavaScript runtime creating a MOP will pass a JavaScript MOP here). If
a MOP of the same class is later discovered in JARs on the class path,
it will be ignored and the explicitly passed instance used.elementsShadowMethods
- the order of fallback MOPs. If true, List
and Map MOP are put before the beans MOP. If false, beans MOP is put
before the List and Map MOP. Note that List and Map MOPs implement
ClassBasedMetaobjectProtocol
while beans MOP does not, so you'll
generally get better performance if you pass true for this parameter.methodsEnumerable
- if true, then objects' methods and JavaBeans
properties show up in the results of
BaseMetaobjectProtocol.properties(Object)
and
MetaobjectProtocol.propertyIds(Object)
. If false, these can
still be accessed by directly addressing them, but don't show up in
aforementioned methods' results.
java.io.IOException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
public static MetaobjectProtocol createStandardMetaobjectProtocol(java.lang.ClassLoader classLoader, MetaobjectProtocol[] prioritized, MetaobjectProtocol[] fallbacks) throws java.io.IOException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException
classLoader
- the class loader within which the MOPs are
discovered. null can be used to denote the
system class loader
, although
you'll usually want the thread context class loader instead.prioritized
- an array of precreated, prioritized MOPs. These MOPs
will be given a chance to handle objects before any automatically
discovered MOPs. Can be null.fallbacks
- an array of precreated fallback MOPs. These MOPs will
be given a chance to handle objects after any automatically discovered
MOPs. Tipically, you'll want to specify an instance of
BeansMetaobjectProtocol
, an instance of
ListMetaobjectProtocol
, an instance of
MapMetaobjectProtocol
(in order of your preference), and an
instance of BottomMetaobjectProtocol
to seal it all. The method
createStandardFallback(boolean, boolean)
can be used to
conveniently create this standard fallback MOP configuration.
java.io.IOException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
public static MetaobjectProtocol[] createStandardFallback(boolean elementsShadowMethods, boolean methodsEnumerable)
createStandardMetaobjectProtocol(ClassLoader,
MetaobjectProtocol[], MetaobjectProtocol[])
. The sequence consists of
a BeansMetaobjectProtocol
, MapMetaobjectProtocol
,
ListMetaobjectProtocol
, and ultimately of a
BottomMetaobjectProtocol
.
elementsShadowMethods
- if true, map and list MOPs are put before
the beans MOP (thus, map elements will hide bean properties and
methods). If false, beans MOP is put first (thus, bean properties and
methods will shadow map elements). Note that List and Map MOPs implement
ClassBasedMetaobjectProtocol
while beans MOP does not, so you'll
generally get better performance if you pass true for this parameter.methodsEnumerable
- if true, then objects' methods and JavaBeans
properties show up in the results of
BaseMetaobjectProtocol.properties(Object)
and
MetaobjectProtocol.propertyIds(Object)
. If false, these can
still be accessed by directly addressing them, but don't show up in
aforementioned methods' results.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |