|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.2.0) E17493-03 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.ide.panels.MetaTraversable
public class MetaTraversable
The MetaTraversable
class is responsible for specifying metadata for a Traversable
that has not yet been instantiated. The MetaTraversable
class allows Traversable
objects to be instantiated lazily while still providing some facility for context-sensitive customization of the Traversable
creation and usage.
A typical example of context-sensitive customization is specifying the help topic ID associated with the Traversable
. In cases where the same Traversable
implementation can be used in different help contexts, each help context is specified through the MetaTraversable
rather than in the Traversable
implementation itself. This approach avoids cluttering the Traversable
with code that determines the help topic ID based on where it is being used.
Constructor Summary | |
---|---|
protected |
MetaTraversable() Should only be used by copyTo(Object) . |
|
MetaTraversable(java.lang.Class traversableClass) Creates a MetaTraversable that instantiates the specified Traversable class using its default constructor. |
|
MetaTraversable(java.lang.Class traversableClass, java.lang.Class[] constructorArgTypes, java.lang.Object[] constructorArgs) Creates a MetaTraversable that instantiates the specified Traversable class using the constructor whose parameter types exactly match the types indicated by constructorArgTypes . |
protected |
MetaTraversable(java.lang.String traversableClassStr) |
Method Summary | |
---|---|
java.lang.Object |
copyTo(java.lang.Object target) Copies the internal state of this object to the specified copy . |
protected void |
copyToImpl(MetaTraversable copy) |
static java.lang.String |
findHelpID(MetaTraversable metaTrav, Traversable trav) Internal only. |
java.lang.Class |
getTraversableClass() Returns the class object of the described Traversable . |
boolean |
isUsingTraversableDefaultConstructor() Returns true of the construction of the associated Traversable uses its default constructor; returns false if a constructor other than the default is used. |
protected Traversable |
newTraversable() Overriding this method is the preferred means of overriding MetaTraversable 's Traversable creation behavior. |
Traversable |
newTraversable(ApplyNotifier applyNotifier) This method specifies the Traversable that will be used in association with the Navigable ; in general, only NavigableUIContainer implementations should call this method directly. |
void |
setHelpID(java.lang.String helpID) By default, a MetaTraversable does not specify a context-sensitive help topic ID; it is normally the responsibility of the Traversable to have the right help ID. |
void |
setNameLink(java.lang.String name, java.lang.String alias) This method provides a means of mapping the data name used by a Traversable to the data name that an object has in the TraversableContext . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MetaTraversable(java.lang.Class traversableClass)
MetaTraversable
that instantiates the specified Traversable
class using its default constructor. The default constructor of the specified class must be public.public MetaTraversable(java.lang.Class traversableClass, java.lang.Class[] constructorArgTypes, java.lang.Object[] constructorArgs)
MetaTraversable
that instantiates the specified Traversable
class using the constructor whose parameter types exactly match the types indicated by constructorArgTypes
. The constructor must be public. When the constructor is called, constructorArgs
will be passed in as the arguments.
The specified traversable class is allowed to be null. In this case, MetaTraversable
must be subclassed, and the subclass must override newTraversable(ApplyNotifier)
. Otherwise,
protected MetaTraversable()
copyTo(Object)
.protected MetaTraversable(java.lang.String traversableClassStr)
Method Detail |
---|
public java.lang.Object copyTo(java.lang.Object target)
Copyable
this
object to the specified copy
. If copy
is null
, then this method should create a new instance of this
class and proceed to copy the internal state to the newly created object. Generally, only the persistent state of the object should be copied, but whether or not it is appropriate to copy transient properties is at the discretion of the individual implementor.
Regardless of whether the copy occurs to an existing object or to a newly created object, the return value is object to which this
object's state was copied.
There is a standard implementation pattern for the copyTo
method that helps avoid problems that arise when a Copyable
object is subclassed. The pattern is:
The parameter passed into thepublic Object copyTo( Object target ) { final <this_class> copy = target != null ? (<this_class>) target : new <this_class>(); copyToImpl( copy ); return copy; } protected final void copyToImpl( <this_class> copy ) { super.copyToImpl( copy ); // if necessary // put code here for copying the properties of <this_class> }
copyToImpl
method is the same type of this
class. The responsibility of copyToImpl
is to copy the state of this
class through direct access of the fields. The copyToImpl
method should not use getters and setters since these may be overridden, causing the state of this
class to be incompletely copied.copyTo
in interface Copyable
target
- The target object to which the state of this
object should be copied. If target
is null
, then the copyTo
method will return a new instance of this
class.this
object was copied. If the target
was non-null
, then the return value is the same as the target
object that was passed in; otherwise, the return value is a new instance of this
class.protected final void copyToImpl(MetaTraversable copy)
public boolean isUsingTraversableDefaultConstructor()
true
of the construction of the associated Traversable
uses its default constructor; returns false
if a constructor other than the default is used.public java.lang.Class getTraversableClass()
Traversable
.public Traversable newTraversable(ApplyNotifier applyNotifier)
Traversable
that will be used in association with the Navigable
; in general, only NavigableUIContainer
implementations should call this method directly.
NOTE: Subclasses should override the newTraversable()
method instead of this method whenever possible. The reason for this is that the implementation of this method takes care of registering the Traversable
returned by newTraversable()
as an ApplyListener
.
Implementations should return a new Traversable
instance each time this method is called; specifically the implementation should not attempt to cache the returned Traversable
because caching is the responsibility of the NavigableUIContainer
that is rendering this Navigable
.
By default, this method uses the Class
that was specified when this Navigable
was created and calls Class.newInstance()
on that Class
to create the new Traversable
. If the class is null
or the class does not implement a public default constructor or the newly created object cannot be cast to Traversable
, this method will return an instance of DefaultTraversablePanel
. If the class implements the ApplyListener
interface, then the Traversable
instance will be added as an ApplyListener
to the NavigableUIContainer
as well.
applyNotifier
- Subclasses that override this method can register an ApplyListener
with the NavigableUIContainer
.Traversable
which represents the detail UI component that is shown when the user selects this Navigable
in the NavigableUIContainer
.public void setHelpID(java.lang.String helpID)
MetaTraversable
does not specify a context-sensitive help topic ID; it is normally the responsibility of the Traversable
to have the right help ID. However, in cases where the same Traversable
is used in different help contexts, this method is provided to override the help ID that is specified by the Traversable
.public void setNameLink(java.lang.String name, java.lang.String alias)
Traversable
to the data name that an object has in the TraversableContext
. Normally, the name used by the Traversable
will not need to be re-mapped, but there are situations where this extra level of indirection in the naming is necessary.
A Traversable
locates data objects by querying the TraversableContext
with the names of the data objects that it needs. However, if the data scope contains multiple instances of one of these data classes, each instance will need to have a different name. In such a situation, the same Traversable
class will normally be used to edit all instances of that data class. The data instance that the Traversable
ends up acquiring via Namespace.find(String)
depends on the name link that is associated with the MetaTraversable
that activated the Traversable
. This method establishes such a name link.
name
- The name that the Traversable
will use when calling TraversableContext#find(String)
. A null
name is allowed.alias
- The actual name of the object that resides in the TraversableContext
. This object is delivered to the Traversable
when the TraversableContext#find(String)
method is called and this MetaTraversable
is currently selected. A null
alias is allowed.protected Traversable newTraversable()
MetaTraversable
's Traversable
creation behavior.
This method is called by newTraversable(ApplyNotifier)
, which then also registers the returned Traversable
with the current ApplyNotifier
, if the Traversable
is an instance of ApplyListener
.
public static final java.lang.String findHelpID(MetaTraversable metaTrav, Traversable trav)
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.2.0) E17493-03 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |