Class AbstractValueResource<V>

java.lang.Object
com.globalmentor.net.AbstractValueResource<V>
Type Parameters:
V - The type of value represented by the resource.
All Implemented Interfaces:
Resource, ValueResource<V>
Direct Known Subclasses:
DefaultValueResource

public abstract class AbstractValueResource<V> extends Object implements ValueResource<V>
An abstract implementation of a resource that represents some value object instance.

This implementation provides no representation of URI, on the basis that many implementations may wish to dynamically generate a URI based upon the value being held.

Author:
Garret Wilson
  • Constructor Details

    • AbstractValueResource

      public AbstractValueResource(Class<V> valueClass, V value)
      Constructor.
      Parameters:
      valueClass - The class representing the type of value represented by the resource.
      value - The non-null value represented by the resource.
      Throws:
      NullPointerException - if the given value class and/or value is null.
  • Method Details

    • getValueClass

      public Class<V> getValueClass()
      Specified by:
      getValueClass in interface ValueResource<V>
      Returns:
      The class representing the type of value represented by the resource.
    • getValue

      public V getValue()
      Specified by:
      getValue in interface ValueResource<V>
      Returns:
      The non-null value represented by the resource.