Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


oracle.javatools.util
Class Holder<T>

java.lang.Object
  extended by oracle.javatools.util.Holder<T>


public class Holder<T>
extends java.lang.Object

A mutable holder class modeled on the JAX-WS 2.0 Holder class that simply provides a common way of providing an in/out parameter without the need to resort to untidy one length array parameters.

This can also be applied to cases where you need a return value back from a inner or local class. Take for example code that requires the use of the Runnable interface, the following code could be used:

   final Holder<Integer> h = new Holder(3);
   SwingUtilities.invokeAndWait(new Runnable()
   {
     public void run()
     {
       h.set(doSomethingClever());
     }
   });
  
   return 9 + h.get();
 

Ideally in the above exmaple you would use and API that could make use of the Future interface; but in many cases API have not been updated.


Field Summary
 T value
           

 

Constructor Summary
Holder()
           
Holder(T value)
           

 

Method Summary
 T get()
           
 void set(T value)
           
 java.lang.String toString()
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Field Detail

value

public T value

Constructor Detail

Holder

public Holder()

Holder

public Holder(T value)

Method Detail

get

public T get()

set

public void set(T value)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


Copyright © 1997, 2012, Oracle. All rights reserved.