Package org.skriptlang.skript.util
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:
Once this has been
When this is no longer
Implementations may expose their own (re)validate method, but this is outside the scope of this interface and so is not provided by default.
- 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 Details
-
invalidate
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 anUnsupportedOperationException
, 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
- Returns:
- A single-use validator marker with thread safety
-