Package com.chemaxon.descriptors.common
Class Guarded.EnsureThat
- java.lang.Object
-
- com.chemaxon.descriptors.common.Guarded.EnsureThat
-
- Enclosing interface:
- Guarded
@Beta @PublicAPI public static class Guarded.EnsureThat extends Object
Guarded checking utility.Please note that this class is marked with
Beta
annotation, so it can be subject of incompatible changes or removal in later releases.
-
-
Constructor Summary
Constructors Constructor Description EnsureThat()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
compatible(Guarded base, String name, Guarded named)
Ensure the guard object based compatibility of two objects.static void
compatibleWithGuard(Object bg, String name, Guarded named)
Ensure the guard object based compatibility of two objects.static void
valid(String name, Guarded checked)
Ensure that guarded context is valid.static void
validGuardObject(String name, Object guardObject)
Ensure that guard object is valid.
-
-
-
Method Detail
-
compatibleWithGuard
public static void compatibleWithGuard(Object bg, String name, Guarded named)
Ensure the guard object based compatibility of two objects. This method should be called when guard object based compatibility criteria can be checked.- Parameters:
bg
- Base guard objectname
- Name of named objectnamed
- Named object- Throws:
NullPointerException
- when either parameter oor returned guard object isnull
IllegalArgumentException
- in case of guard object mismatch. Message is in the form "Guard object mismatch of <name>: Expected <base-guard-object> (0x<base-identity-hex>), got <named-guard-object> (0x<named-identity-hex>).
"
-
compatible
public static void compatible(Guarded base, String name, Guarded named)
Ensure the guard object based compatibility of two objects. This method should be called when guard object based compatibility criteria can be checked.- Parameters:
base
- Base objectname
- Name of named objectnamed
- Named object- Throws:
NullPointerException
- when either parameter oor returned guard object isnull
IllegalArgumentException
- in case of guard object mismatch. Message is in the form "Guard object mismatch of <name>: Expected <base-guard-object> (0x<base-identity-hex>), got <named-guard-object> (0x<named-identity-hex>).
"
-
valid
public static void valid(String name, Guarded checked)
Ensure that guarded context is valid. Currently check that the checked object or its guard object is notnull
. This method should be called when a guard object reference is delegated, typically in a constructor.- Parameters:
name
- Name of the guarded entitychecked
- Checked object
-
-