com.asprise.imaging.scan

## Class Capability

- java.lang.Object
- - com.asprise.imaging.scan.Capability

- Direct Known Subclasses:
    WiaCapability

      public abstract class Capability
      extends Object

  Represents a capability that a device or a functional unit owns.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Capability.ValidValues` Represents a value validator.
    `static class` | `Capability.ValidValuesFlag` Flag based value validator.
    `static class` | `Capability.ValidValuesList` Listed based value validator.
    `static class` | `Capability.ValidValuesRange` Represents a range based value validator.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `getCurrentValue()` The current value returned from the device
    `Long` | `getCurrentValueAsLong()` Returns the current value as long or null if it is null
    `String` | `getCurrentValueAsString()` Returns the current value as string or null if it is null
    `String` | `getDescription()`
    `long` | `getFlags()` Access and permission flags.
    `long` | `getId()` The id of the capability
    `String` | `getName()` Name of the capability.
    `Object` | `getNewValue()` New value to be set to the device.
    `long` | `getType()` Data type.
    `Capability.ValidValues` | `getValidValues()` Value validator if available
    `Object` | `getValue()` Returns the new value if it has been set otherwise the current value.
    `Long` | `getValueAsLong()` Returns the new value if it has been set otherwise the current value.
    `String` | `getValueAsString()` Returns the new value if it has been set, current value otherwise.
    `boolean` | `hasNewValue()` Whether new value has been set.
    `boolean` | `isForceSet()` Whether value should be write to the device even it is the same as the getCurrentValue() .
    `boolean` | `isThrowExceptionIfSetFailed()` Whether an exception should be thrown when failing to set the new value.
    `abstract boolean` | `isWritable()` Whether this capability allows the end user to set.
    `boolean` | `needToWriteToDevice()` Whether the new value will be actually sent to the device before scanning.
    `void` | `setForceSet(boolean forceSet)` Whether value should be write to the device even it is the same as the getCurrentValue() .
    `void` | `setNewValue(Object newValue)` New value to be set to the device.
    `void` | `setThrowExceptionIfSetFailed(boolean throwExceptionIfSetFailed)` Whether an exception should be thrown when failing to set the new value.
    `void` | `unset()` Clears the new value that has been set.
    `void` | `update(Capability latest)` Updates information from the latest retrieval.

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

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

- - ### Method Detail

    - #### update

          public void update(Capability latest)

      Updates information from the latest retrieval. newValue and forceSet will not be copied.
      Parameters:
        `latest` - target to copy from

    - #### getId

          public long getId()

      The id of the capability

    - #### getName

          public String getName()

      Name of the capability.

    - #### getDescription

          public String getDescription()

    - #### getType

          public long getType()

      Data type.

    - #### getFlags

          public long getFlags()

      Access and permission flags.

    - #### getValidValues

          public Capability.ValidValues getValidValues()

      Value validator if available

    - #### getCurrentValue

          public Object getCurrentValue()

      The current value returned from the device

    - #### getCurrentValueAsString

          public String getCurrentValueAsString()

      Returns the current value as string or null if it is null
      Returns:
        the current value as string or null if it is null

    - #### getCurrentValueAsLong

          public Long getCurrentValueAsLong()

      Returns the current value as long or null if it is null
      Returns:
        the current value as long or null if it is null
      Throws:
        `NumberFormatException` - if the current value can not be converted to a number

    - #### isWritable

          public abstract boolean isWritable()

      Whether this capability allows the end user to set.
      Returns:
        true if the user can set a new value or false otherwise.

    - #### hasNewValue

          public boolean hasNewValue()

      Whether new value has been set.
      Returns:
        true if new value has been set or false otherwise.

    - #### unset

          public void unset()

      Clears the new value that has been set.

    - #### getNewValue

          public Object getNewValue()

      New value to be set to the device.

    - #### setNewValue

          public void setNewValue(Object newValue)

      New value to be set to the device. New value will only be set to the device immediately before a scan or preview.

    - #### getValue

          public Object getValue()

      Returns the new value if it has been set otherwise the current value.

    - #### getValueAsString

          public String getValueAsString()

      Returns the new value if it has been set, current value otherwise.
      Returns:
        the value as string or null if it is null

    - #### getValueAsLong

          public Long getValueAsLong()

      Returns the new value if it has been set otherwise the current value.
      Throws:
        `NumberFormatException` - if the current value can not be converted to a number

    - #### isForceSet

          public boolean isForceSet()

      Whether value should be write to the device even it is the same as the getCurrentValue() .

    - #### setForceSet

          public void setForceSet(boolean forceSet)

      Whether value should be write to the device even it is the same as the getCurrentValue() .

    - #### needToWriteToDevice

          public boolean needToWriteToDevice()

      Whether the new value will be actually sent to the device before scanning.
      Returns:
        true if you have set a new value and (it is different from current value OR forceSet true).

    - #### isThrowExceptionIfSetFailed

          public boolean isThrowExceptionIfSetFailed()

      Whether an exception should be thrown when failing to set the new value.
      Returns:

    - #### setThrowExceptionIfSetFailed

          public void setThrowExceptionIfSetFailed(boolean throwExceptionIfSetFailed)

      Whether an exception should be thrown when failing to set the new value.
      Parameters:
        `throwExceptionIfSetFailed` -

Copyright © Asprise Software. All Rights Reserved. Please visit the product page at asprise.com