Fork me on GitHub

Now on: joopl.Enum

Available since 2.3.0

Represents an utility class to work with enumerations.

Methods

parseName

(
  • enumType
  • valueName
)
static

Defined in src\joopl.js:1192

Parses a text into a given enumeration value

Parameters:

  • enumType Enum

    The enumeration definition (i.e. State, ConnectionTypes, ...)

  • valueName String

    The value name to be parsed (i.e. If an enumeration called States would have an open and closed values, open or closed would be a value names)

Example:

$namespace.using("joopl", function(joopl) {
    joopl.declareEnum("State", {
        open: 1,
        closed: 2
    });

    var open = joopl.Enum.parseName(State, "open")
});

parseNames

(
  • enumType
  • valueNames
)
static

Defined in src\joopl.js:1220

Parses a comma-separated list of text values as a mask of given enumeration

Parameters:

  • enumType Enum

    The enumeration definition (i.e. State, ConnectionTypes, ...)

  • valueNames String

    A comma-separated list of a mask of given enumeration type (i.e. "open, closed, working").

Example:

$namespace.using("joopl", function(joopl) {
    joopl.declareEnum("State", {
        open: 1,
        closed: 2
    });

    joopl.Enum.parseNames(State, "open, closed")
});