de.esprit.common.util

## Class SingleAccess

- java.lang.Object
- - de.esprit.common.util.SingleAccess

- All Implemented Interfaces:
    Resettable

      public class SingleAccess
      extends java.lang.Object
      implements Resettable

  This class implements a access point that can only be accessed once. Any second call to `access()` will throw an `IllegalStateException` with the given error message.
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SingleAccess()`
    `SingleAccess(java.lang.String errMsg)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `access()` Can only be called once.
    `void` | `reset()` Undoes the last access.
    `boolean` | `wasAccessed()` Tells whether this access point has been accessed already.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SingleAccess

          public SingleAccess()

    - #### SingleAccess

          public SingleAccess(java.lang.String errMsg)

  - ### Method Detail

    - #### access

          public void access()

      Can only be called once. Any further access will throw an IllegalStateException.

    - #### wasAccessed

          public boolean wasAccessed()

      Tells whether this access point has been accessed already.

    - #### reset

          public void reset()

      Undoes the last access.
      Specified by:
        `reset` in interface `Resettable`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.