Summary: Nested Classes | Ctors | Methods | Protected Methods | Inherited Methods | [Expand All]

# SimpleAtom

`public class SimpleAtom`
`extends Object` `implements Atom<Evaluation>`

java.lang.Object
↳ | android.support.test.espresso.web.model.SimpleAtom

A simple implementation of Atom suitable for subclassing.

## Summary

### Nested classes
`enum` | `SimpleAtom.ElementReferencePlacement` Controls whether the ElementReference appears as the first arg or last arg to the script.

### Public constructors
`SimpleAtom(String script)` Creates a SimpleAtom which runs the given script and places any ElementReference as the first argument to the script.
`SimpleAtom(String script, SimpleAtom.ElementReferencePlacement elementPlacement)` Creates a SimpleAtom which runs the given script and places any supplied ElementReference either as the first or last argument to the script.

### Public methods
`final List<? extends Object>` | `getArguments(ElementReference elementRef)` The SimpleAtom presents an argument list to the script which follows some basic conventions.
`final String` | `getScript()` Returns the script this SimpleAtom was created with.
`final Evaluation` | `transform(Evaluation e)` The SimpleAtom's transform method checks the Evaluation object for success.

### Protected methods
`List<? extends Object>` | `getNonContextualArguments()` Extend this method to pass additional arguments to the script.
`Evaluation` | `handleBadEvaluation(Evaluation e)` Extend this method to handle a failure code in the Evaluation object.
`void` | `handleNoElementReference()` Extend this method to handle the case where getArguments() has been called without an ElementReference.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()`
`boolean` | `equals(Object arg0)`
`void` | `finalize()`
`final Class<?>` | `getClass()`
`int` | `hashCode()`
`final void` | `notify()`
`final void` | `notifyAll()`
`String` | `toString()`
`final void` | `wait(long arg0, int arg1)`
`final void` | `wait(long arg0)`
`final void` | `wait()`
From interface `android.support.test.espresso.web.model.Atom`
`abstract List<? extends Object>` | `getArguments(ElementReference elementContext)` Creates a list of arguments to pass to the script.
`abstract String` | `getScript()` Provides the script to be evaluated.
`abstract Evaluation` | `transform(Evaluation evaluation)` Converts an Evaluation into another more suitable type.

## Public constructors

### SimpleAtom

    SimpleAtom (String script)

Creates a SimpleAtom which runs the given script and places any ElementReference as the first argument to the script.

Parameters
`script` | `String`

### SimpleAtom

    SimpleAtom (String script,
                    SimpleAtom.ElementReferencePlacement elementPlacement)

Creates a SimpleAtom which runs the given script and places any supplied ElementReference either as the first or last argument to the script.

Parameters
`script` | `String`
`elementPlacement` | `SimpleAtom.ElementReferencePlacement`

## Public methods

### getArguments

    List<? extends Object> getArguments (ElementReference elementRef)

The SimpleAtom presents an argument list to the script which follows some basic conventions. If an ElementReference is provided, it is placed either in the first or last position based on the ElementReferencePlacement provided to the constructor. The nonContextualArguments (if provided via getNonContextualArguments) will appear after the ElementReference.

Parameters
`elementRef` | `ElementReference`: null unless an ElementReference has been supplied to execute this atom with.

Returns
`List<? extends Object>` | the List of objects to pass to the script as arguments.

### getScript

    String getScript ()

Returns the script this SimpleAtom was created with.

Returns
`String` |

### transform

    Evaluation transform (Evaluation e)

The SimpleAtom's transform method checks the Evaluation object for success. If the Evaluation object has an error, the default behaviour is to throw an exception, subclasses may change this behaviour via the handleBadEvaluation method.

Parameters
`e` | `Evaluation`

Returns
`Evaluation` |

## Protected methods

### getNonContextualArguments

    List<? extends Object> getNonContextualArguments ()

Extend this method to pass additional arguments to the script.

Returns
`List<? extends Object>` | a list of arguments (non-null)

### handleBadEvaluation

    Evaluation handleBadEvaluation (Evaluation e)

Extend this method to handle a failure code in the Evaluation object. The default implementation will throw an exception, subclasses may want to ignore certain failure cases.

Parameters
`e` | `Evaluation`

Returns
`Evaluation` | Evaluation the evaluation object (must be non-null)

Throws
`RuntimeException` | if the badness level is too high.

### handleNoElementReference

    void handleNoElementReference ()

Extend this method to handle the case where getArguments() has been called without an ElementReference. Implementors may want to throw an exception here if they require an ElementReference to evaluate properly.

- ## Interfaces

  - Atom
  - JSONAble
  - JSONAble.DeJSONFactory
  - TransformingAtom.Transformer

- ## Classes

  - Atoms
  - ElementReference
  - Evaluation
  - ModelCodec
  - SimpleAtom
  - TransformingAtom
  - WindowReference

- ## Enums

  - SimpleAtom.ElementReferencePlacement