Class LeafNode<T>

java.lang.Object
com.yahoo.config.Node
com.yahoo.config.LeafNode<T>
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
BooleanNode, DoubleNode, EnumNode, FileNode, IntegerNode, LongNode, ModelNode, PathNode, ReferenceNode, StringNode, UrlNode

public abstract class LeafNode<T> extends Node implements Cloneable
Superclass for all leaf nodes in a ConfigInstance.

Subclasses represent leaf nodes with different types. These implementations should implement method value() with return-value corresponding to the actual type.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
    protected T
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new, uninitialized LeafNode
    protected
    LeafNode(boolean initialized)
    Creates a new LeafNode.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected LeafNode<?>
    This method is meant for internal use in the configuration system.
    protected abstract boolean
     
    boolean
     
    abstract String
    Subclasses must implement this, in compliance with the rules given in the return tag.
    int
     
    protected final boolean
    Sets the value based on a string representation.
    abstract String
    Subclasses must implement this, in compliance with the rules given in the return tag.
     

    Methods inherited from class com.yahoo.config.Node

    postInitialize

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • initialized

      protected boolean initialized
    • value

      protected T value
  • Constructor Details

    • LeafNode

      protected LeafNode()
      Creates a new, uninitialized LeafNode
    • LeafNode

      protected LeafNode(boolean initialized)
      Creates a new LeafNode.
      Parameters:
      initialized - true if this node is initialized.
  • Method Details

    • value

      public T value()
    • toString

      public abstract String toString()
      Subclasses must implement this, in compliance with the rules given in the return tag.
      Overrides:
      toString in class Object
      Returns:
      the String representation of the node value, or the string "(null)" if the value is null.
    • getValue

      public abstract String getValue()
      Subclasses must implement this, in compliance with the rules given in the return tag.
      Returns:
      the String representation of the node value, or the 'null' object if the node value is null.
    • setValue

      protected final boolean setValue(String value)
      Sets the value based on a string representation. Returns false if the value could not be set from the given string. TODO: return void (see doSetValue)
      Parameters:
      value - the value to set
      Returns:
      true on success, false otherwise
      Throws:
      IllegalArgumentException - when value is null
    • doSetValue

      protected abstract boolean doSetValue(String value)
    • clone

      protected LeafNode<?> clone()
      This method is meant for internal use in the configuration system. Overrides Object.clone().
      Overrides:
      clone in class Node
      Returns:
      a new instance similar to this object.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object