Class Holder<V>

  extended by ariba.util.core.Holder<V>

public abstract class Holder<V>
extends java.lang.Object

Convenience class that makes it a little simpler to write a lazily evalated value.

Use as follows. Instead of writing:

    List<String> _list;
    public List<String> list() {
      if (_list == null) {
        _list = initialzeList();
      return _list;
You write:
    Holder<List<String>> _list = new Holder<List<String>>() {
        protected List<String> initialValue() { 
          return initializeList();
You then access the value by _list.get().indexOf("foo") etc.

Constructor Summary
Method Summary
 V get()
          Returns the value held by this.
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Holder()
Method Detail


public V get()
Returns the value held by this.

AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.