|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.erights.e.elib.slot.BaseGuard
|
+--org.erights.e.elib.slot.NullOkGuard
Safe: The canonical instance (THE_ONE) is bound to "nullOk" in the initial environment, and accepts null as a valid value.
As a ValueGuard, "nullOk" accepts only null as a valid value.
As a SlotGuard, "nullOk" makes a settable slot that only accepts nulls.
As a ValueGuard & SlotGuard template, "nullOk(valueGuard)" produces an object that implements ValueGuard and SlotGuard. (This object is also an instance of NullOkGuard, but no one should care.) As a ValueGuard, this object accepts null and whatever the argument valueGuard accepts. As a SlotGuard, it makes settable slots that accept null and whatever the original valueGuard accepts. In both cases, non-null values are coerced according to the original valueGuard.
| Field Summary | |
private ValueGuard |
myOptSubGuard
|
static NullOkGuard |
THE_ONE
Enabled: |
| Fields inherited from class org.erights.e.elib.slot.BaseGuard |
myOptValueGuard |
| Constructor Summary | |
private |
NullOkGuard(ValueGuard optSubGuard)
|
| Method Summary | |
Object |
coerce(Object specimen,
OneArgFunc optEjector)
Enabled: If specimen is null, returns null. |
String |
getName()
Enabled: "nullOk" or "nullOk(sub-guard-name)" |
NullOkGuard |
run(ValueGuard subGuard)
Enabled: Makes a Guard that accepts either null or values that the argument 'subGuard' accepts. |
| Methods inherited from class org.erights.e.elib.slot.BaseGuard |
__printOn, accepts, and, butNot, coerce, get, makeSlot, makeSlot, not, or, toString, xor |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final NullOkGuard THE_ONE
private final ValueGuard myOptSubGuard
| Constructor Detail |
private NullOkGuard(ValueGuard optSubGuard)
| Method Detail |
public Object coerce(Object specimen,
OneArgFunc optEjector)
coerce in interface ValueGuardcoerce in class BaseGuardpublic NullOkGuard run(ValueGuard subGuard)
Non-null values are coerced by the argument. As a SlotGuard, makes settable slots.
public String getName()
getName in interface SlotGuardgetName in class BaseGuard
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||