Top Description Fields Constructors Methods
org.droidparts.dexmaker.dx.util

public Class MutabilityControl

extends Object
Class Inheritance
Known Direct Subclasses
org.droidparts.dexmaker.dx.rop.annotation.Annotation, org.droidparts.dexmaker.dx.rop.annotation.Annotations, org.droidparts.dexmaker.dx.rop.code.LocalVariableInfo, org.droidparts.dexmaker.dx.rop.code.RegisterSpecSet, org.droidparts.dexmaker.dx.rop.cst.StdConstantPool, org.droidparts.dexmaker.dx.ssa.LocalVariableInfo, org.droidparts.dexmaker.dx.util.FixedSizeList, org.droidparts.dexmaker.dx.util.IntList

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.

Field Summary

Modifier and TypeField and Description
private boolean
mutable

whether this instance is mutable

Constructor Summary

AccessConstructor and Description
public
MutabilityControl()

Constructs an instance.

public
MutabilityControl(boolean
true iff this instance is mutable
mutable
)

Constructs an instance, explicitly indicating the mutability.

Method Summary

Modifier and TypeMethod and Description
public final boolean

Returns:

true iff this instance is immutable
isImmutable
()

Checks to see whether or not this instance is immutable.

public final boolean

Returns:

true iff this instance is mutable
isMutable
()

Checks to see whether or not this instance is mutable.

public void
setImmutable()

Makes this instance immutable.

public final void
throwIfImmutable()

Throws MutabilityException if this instance is immutable.

public final void
throwIfMutable()

Throws MutabilityException if this instance is mutable.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mutableback to summary
private boolean mutable

whether this instance is mutable

Constructor Detail

MutabilityControlback to summary
public MutabilityControl()

Constructs an instance. It is initially mutable.

MutabilityControlback to summary
public MutabilityControl(boolean mutable)

Constructs an instance, explicitly indicating the mutability.

Parameters
mutable:boolean

true iff this instance is mutable

Method Detail

isImmutableback to summary
public final boolean isImmutable()

Checks to see whether or not this instance is immutable. This is the same as calling !isMutable().

Returns:boolean

true iff this instance is immutable

isMutableback to summary
public final boolean isMutable()

Checks to see whether or not this instance is mutable.

Returns:boolean

true iff this instance is mutable

setImmutableback to summary
public void setImmutable()

Makes this instance immutable.

throwIfImmutableback to summary
public final void throwIfImmutable()

Throws MutabilityException if this instance is immutable.

throwIfMutableback to summary
public final void throwIfMutable()

Throws MutabilityException if this instance is mutable.