org.erights.e.elib.slot
Class FinalGuard

java.lang.Object
  |
  +--org.erights.e.elib.slot.BaseGuard
        |
        +--org.erights.e.elib.slot.FinalGuard
All Implemented Interfaces:
Guard, SlotGuard, ValueGuard

public final class FinalGuard
extends BaseGuard

Safe: The canonical instance, bound to "final" in the initial environment, is a SlotGuard that makes final slots, coercing the permanent value through an optional valueGuard argument, if present.

As a SlotGuard, "final" makes an immutable slot whose permanent value is the uncoerced specimen.

As a SlotGuardTemplate, "final(valueGuard)" makes a SlotGuard that will make an immutable slot whose initial value is the specimen coerced by this valueGuard.

Author:
Mark S. Miller

Field Summary
static FinalGuard THE_ONE
          Enabled:
 
Fields inherited from class org.erights.e.elib.slot.BaseGuard
myOptValueGuard
 
Constructor Summary
private FinalGuard(ValueGuard optValueGuard)
           
 
Method Summary
 String getName()
          Enabled: "final" or "final(value-guard-name)".
 Slot makeSlot(Object specimen, OneArgFunc optEjector)
          Enabled: Returns a FinalSlot that immutably holds the specimen (as coerced by my encapsulated ValueGuard, if present).
 FinalGuard run(ValueGuard valueGuard)
          Enabled: Makes a Guard that will coerce a specimen with this valueGuard, and make an immutable slot with the resulting value.
 
Methods inherited from class org.erights.e.elib.slot.BaseGuard
__printOn, accepts, and, butNot, coerce, coerce, get, makeSlot, not, or, toString, xor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

THE_ONE

public static final FinalGuard THE_ONE
Enabled:

Constructor Detail

FinalGuard

private FinalGuard(ValueGuard optValueGuard)
Parameters:
optValueGuard -
Method Detail

makeSlot

public Slot makeSlot(Object specimen,
                     OneArgFunc optEjector)
Enabled: Returns a FinalSlot that immutably holds the specimen (as coerced by my encapsulated ValueGuard, if present).

Specified by:
makeSlot in interface SlotGuard
Overrides:
makeSlot in class BaseGuard

run

public FinalGuard run(ValueGuard valueGuard)
Enabled: Makes a Guard that will coerce a specimen with this valueGuard, and make an immutable slot with the resulting value.


getName

public String getName()
Enabled: "final" or "final(value-guard-name)".

Specified by:
getName in interface SlotGuard
Overrides:
getName in class BaseGuard


comments?