Atoms

public final class Atoms


Utility class wrapping simple and more commonly used atoms.

Summary

Public constructors

Public methods

static TransformingAtom.Transformer<Evaluation, E>
<E> castOrDie(Class<E> clazz)

Creates a transformer which will convert an Evaluation to a given type (or die trying).

static Atom<String>

Returns the value of document.location.href.

static Atom<String>

Returns the value of document.title.

static Atom<O>
<O> script(
    String script,
    TransformingAtom.Transformer<Evaluation, O> transformer
)

Creates an atom that will execute the provided script and return an object created by the given transformer.

static Atom<Evaluation>
script(String script)

Creates an atom that will execute the provided script and return an evaluation object.

static Atom<Evaluation>
scriptWithArgs(String script, List<Object> args)

Creates an atom that will execute the provided script with the given non-contextual arguments.

static Atom<O>
<I, O> transform(
    Atom<I> in,
    TransformingAtom.Transformer<I, O> transformer
)

Creates an atom which wraps the input atom and transforms its output using the given transformer.

Public constructors

Atoms

public Atoms()

Public methods

castOrDie

public static TransformingAtom.Transformer<Evaluation, E> <E> castOrDie(Class<E> clazz)

Creates a transformer which will convert an Evaluation to a given type (or die trying).

getCurrentUrl

public static Atom<StringgetCurrentUrl()

Returns the value of document.location.href.

getTitle

public static Atom<StringgetTitle()

Returns the value of document.title.

script

public static Atom<O> <O> script(
    String script,
    TransformingAtom.Transformer<Evaluation, O> transformer
)

Creates an atom that will execute the provided script and return an object created by the given transformer.

script

public static Atom<Evaluationscript(String script)

Creates an atom that will execute the provided script and return an evaluation object.

scriptWithArgs

public static Atom<EvaluationscriptWithArgs(String script, List<Object> args)

Creates an atom that will execute the provided script with the given non-contextual arguments.

transform

public static Atom<O> <I, O> transform(
    Atom<I> in,
    TransformingAtom.Transformer<I, O> transformer
)

Creates an atom which wraps the input atom and transforms its output using the given transformer.