getSymbol method

Danger<CitrusSymbol, CitrusSymbolTableExceptionB> getSymbol(
  1. String symbolName
)

Implementation

Danger<CitrusSymbol, CitrusSymbolTableExceptionB> getSymbol(String symbolName) {

    final log = Log(classLocation: runtimeType, functionLocation: 'getSymbol');

    final permanentlyResult = textSymbolRoster.getByPrimaryKey(symbolName);
    log.add(permanentlyResult);
    if (permanentlyResult is Success<TextSymbol, RosterPatternExceptionB>) return Success(permanentlyResult.wrapped, log);

    final temporaryResult = temporarySymbolRoster.getByPrimaryKey(symbolName);
    log.add(temporaryResult);
    if (temporaryResult is Success<TemporarySymbol, RosterPatternExceptionB>) return Success(temporaryResult.wrapped, log);

    final listResult = textArraySymbolRoster.getByPrimaryKey(symbolName);
    log.add(listResult);
    if (listResult is Success<TextArraySymbol, RosterPatternExceptionB>) return Success(listResult.wrapped, log);

    final fragmentResult = fragmentSymbolRoster.getByPrimaryKey(symbolName);
    log.add(fragmentResult);
    if (fragmentResult is Success<FragmentSymbol, RosterPatternExceptionB>) return Success(fragmentResult.wrapped, log);

    final flagResult = flagSymbolRoster.getByPrimaryKey(symbolName);
    log.add(flagResult);
    if (flagResult is Success<FlagSymbol, RosterPatternExceptionB>) return Success(flagResult.wrapped, log);

    final objectResult = objectSymbolRoster.getByPrimaryKey(symbolName);
    log.add(objectResult);
    if (objectResult is Success<ObjectSymbol, RosterPatternExceptionB>) return Success(objectResult.wrapped, log);

    final objectArrayResult = objectArraySymbolRoster.getByPrimaryKey(symbolName);
    log.add(objectArrayResult);
    if (objectArrayResult is Success<ObjectArraySymbol, RosterPatternExceptionB>) return Success(objectArrayResult.wrapped, log);

    return Failure(CitrusSymbolTableExceptionB(), log.monitor({
        'not exist symbol': symbolName,
        'exist symbol name list': symbolNameList,
    }));

}