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 Details

    • EnsureThat

      public EnsureThat()
  • Method Details

    • 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 object
      name - Name of named object
      named - Named object
      Throws:
      NullPointerException - when either parameter oor returned guard object is null
      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 object
      name - Name of named object
      named - Named object
      Throws:
      NullPointerException - when either parameter oor returned guard object is null
      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 not null. This method should be called when a guard object reference is delegated, typically in a constructor.

      Parameters:
      name - Name of the guarded entity
      checked - Checked object
    • validGuardObject

      public static void validGuardObject(String name, Object guardObject)
      Ensure that guard object is valid.

      Currently check tat guard object is not null.

      Parameters:
      name - Guard object name
      guardObject - Guard object reference