All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cloudfoundry.multiapps.controller.process.flowable.Action Maven / Gradle / Ivy

There is a newer version: 1.183.0
Show newest version
package org.cloudfoundry.multiapps.controller.process.flowable;

import java.text.MessageFormat;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.cloudfoundry.multiapps.controller.process.Messages;

public enum Action {

    ABORT, RESUME, RETRY, START;

    private static final Map namesToActions = Stream.of(values())
                                                                    .collect(Collectors.toMap(Action::getActionId, Function.identity()));

    public String getActionId() {
        return name().toLowerCase();
    }

    public static Action fromString(String actionId) {
        Action action = namesToActions.get(actionId);
        if (action == null) {
            throw new IllegalArgumentException(MessageFormat.format(Messages.UNSUPPORTED_ACTION, actionId));
        }
        return action;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy