blob: 2feca23dd206502eeada4a439b7ed7e25dce4f18 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.component.provider;
/**
* A class which may be irreversibly frozen. Any attempt to change the state of this class after
* freezing throws an IllegalStateException.
*
* @author bratseth
*/
public interface Freezable {
/**
* Freezes this component to prevent further changes. Override this to freeze internal data
* structures and dependent objects. Overrides must call super.
* Calling freeze on an already frozen class must have no effect.
*/
public void freeze();
/**
* Inspect whether this object can be changed. If the object is immutable
* from construction, this should return true, even if freeze() never has
* been invoked.
*
* @return true if this instance is in an immutable state, false otherwise
* @since 5.1.4
*/
public boolean isFrozen();
}
|