com.android.dx.util
Class MutabilityControl

java.lang.Object
  extended by com.android.dx.util.MutabilityControl
Direct Known Subclasses:
Annotation, Annotations, ExecutionStack, FixedSizeList, IntList, LocalsArray, LocalVariableInfo, LocalVariableInfo, RegisterSpecSet, StdConstantPool, SwitchList

public class MutabilityControl
extends Object

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
MutabilityControl()
          Constructs an instance.
MutabilityControl(boolean mutable)
          Constructs an instance, explicitly indicating the mutability.
 
Method Summary
 boolean isImmutable()
          Checks to see whether or not this instance is immutable.
 boolean isMutable()
          Checks to see whether or not this instance is mutable.
 void setImmutable()
          Makes this instance immutable.
 void throwIfImmutable()
          Throws MutabilityException if this instance is immutable.
 void throwIfMutable()
          Throws MutabilityException if this instance is mutable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

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()
Throws MutabilityException if this instance is immutable.


throwIfMutable

public final void throwIfMutable()
Throws MutabilityException if this instance is mutable.



Copyright © 2015. All rights reserved.