Interface Validated

All Known Implementing Classes:
Config, DynamicFunctionReference, EntryNode, InvalidNode, Node, Script, SectionNode, SimpleNode, VoidNode

public interface Validated
Something that can become invalid due to external conditions, such as:
  • A newer copy of the same thing becomes available.
  • It is a finalised view that no longer reflects the real thing.
  • Some backing object has been deleted or irreparably modified.

Once this has been invalidate()d, its valid() method should return false.
When this is no longer valid(), it may no longer be safe or accurate to use.
Implementations may expose their own (re)validate method, but this is outside the scope of this interface and so is not provided by default.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Mark a thing as no longer safe to use.
    boolean
    Implementations ought to specify what 'valid' means locally (e.g.
    static Validated
     
  • Method Details

    • invalidate

      @Internal void invalidate() throws UnsupportedOperationException
      Mark a thing as no longer safe to use. This should (typically) not be used by external modifiers, but implementations may differ.
      Implementations that do not want to expose an invalidator hook may throw an UnsupportedOperationException, which is protected by the internal contract.
      Throws:
      UnsupportedOperationException - If this is not something that can be externally invalidated.
    • valid

      boolean valid()
      Implementations ought to specify what 'valid' means locally (e.g. should a new copy be obtained?) when overriding this method.
      Returns:
      Whether this is still valid
    • validator

      static Validated validator()
      Returns:
      A single-use validator marker with thread safety