Package com.android.dx.util
Class MutabilityControl
java.lang.Object
com.android.dx.util.MutabilityControl
- Direct Known Subclasses:
Annotation
,Annotations
,ExecutionStack
,FixedSizeList
,IntList
,LocalsArray
,LocalVariableInfo
,LocalVariableInfo
,RegisterSpecSet
,StdConstantPool
,SwitchList
Very simple base class that implements a flag to control the mutability
of instances. This class just provides the flag and a utility to check
and throw the right exception, but it is up to subclasses to place calls
to the checker in all the right places.
-
Constructor Summary
ConstructorDescriptionConstructs an instance.MutabilityControl
(boolean mutable) Constructs an instance, explicitly indicating the mutability. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Checks to see whether or not this instance is immutable.final boolean
Checks to see whether or not this instance is mutable.void
Makes this instance immutable.final void
ThrowsMutabilityException
if this instance is immutable.final void
ThrowsMutabilityException
if this instance is mutable.
-
Constructor Details
-
MutabilityControl
public MutabilityControl()Constructs an instance. It is initially mutable. -
MutabilityControl
public MutabilityControl(boolean mutable) Constructs an instance, explicitly indicating the mutability.- Parameters:
mutable
-true
iff this instance is mutable
-
-
Method Details
-
setImmutable
public void setImmutable()Makes this instance immutable. -
isImmutable
public final boolean isImmutable()Checks to see whether or not this instance is immutable. This is the same as calling!isMutable()
.- Returns:
true
iff this instance is immutable
-
isMutable
public final boolean isMutable()Checks to see whether or not this instance is mutable.- Returns:
true
iff this instance is mutable
-
throwIfImmutable
public final void throwIfImmutable()ThrowsMutabilityException
if this instance is immutable. -
throwIfMutable
public final void throwIfMutable()ThrowsMutabilityException
if this instance is mutable.
-