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

io.sphere.sdk.models.SphereEnumeration Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.models;

import java.util.Arrays;
import java.util.Optional;

public interface SphereEnumeration {
    String name();

    static > Optional findBySphereName(final T[] values, final String sphereName) {
        return Arrays.stream(values)
                .filter(v -> SphereEnumerationUtils.toSphereName(v.name()).equals(sphereName))
                .findFirst();
    }

    default String toSphereName() {
        return SphereEnumerationUtils.toSphereName(name());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy