io.sphere.sdk.models.SphereEnumeration Maven / Gradle / Ivy
The newest version!
package io.sphere.sdk.models;
import java.util.Arrays;
import java.util.Optional;
/**
* Set of enum constants in Composable Commerce.
*
* Hints for importing {@link SphereEnumeration}s:
*
* {@include.example io.sphere.sdk.products.attributes.AttributeConstraintTest#demoImportSphereValue()}
* {@include.example io.sphere.sdk.products.attributes.AttributeConstraintTest#demoImportUpperCase()}
*
* Hints for exporting {@link SphereEnumeration}s:
*
* {@include.example io.sphere.sdk.products.attributes.AttributeConstraintTest#demoExportSphereValue()}
* {@include.example io.sphere.sdk.products.attributes.AttributeConstraintTest#demoExportUpperCase()}
*/
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 - 2025 Weber Informatics LLC | Privacy Policy