com.tectonica.jonix.common.codelist.Proximitys Maven / Gradle / Ivy
/*
* Copyright (C) 2012-2023 Zach Melamed
*
* Latest version available online at https://github.com/zach-m/jonix
* Contact me at [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tectonica.jonix.common.codelist;
import com.tectonica.jonix.common.OnixCodelist;
import java.util.Optional;
/*
* NOTE: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT MANUALLY
*/
/**
* marker interface to assist in IDE navigation to code-list 215 (Proximity)
*/
interface CodeList215 {
}
/**
* Enum
that corresponds to ONIX Codelist 215
*
* Description: Proximity
*
* @see About ONIX Codelists
* @see ONIX
* Codelist 215 in Reference Guide
*/
public enum Proximitys implements OnixCodelist, CodeList215 {
Less_than("01", "Less than"),
Not_more_than("02", "Not more than"),
/**
* The supplier's true figure, or at least a best estimate expected to be within 10% of the true figure (ie a quoted
* figure of 100 could in fact be anything between 91 and 111)
*/
Exactly("03", "Exactly"),
/**
* Generally interpreted as within 25% of the true figure (ie a quoted figure of 100 could in fact be anything
* between 80 and 133). The supplier may introduce a deliberate approximation to reduce the commercial sensitivity
* of the figure
*/
Approximately("04", "Approximately"),
/**
* Generally interpreted as within a factor of two of the true figure (ie a quoted figure of 100 could in fact be
* anything between 50 and 200). The supplier may introduce a deliberate approximation to reduce the commercial
* sensitivity of the figure
*/
About("05", "About"),
Not_less_than("06", "Not less than"),
More_than("07", "More than");
public final String code;
public final String description;
Proximitys(String code, String description) {
this.code = code;
this.description = description;
}
@Override
public String getCode() {
return code;
}
@Override
public String getDescription() {
return description;
}
public static Proximitys byCode(String code) {
if (code == null || code.isEmpty()) {
return null;
}
for (Proximitys e : values()) {
if (e.code.equals(code)) {
return e;
}
}
return null;
}
public static Optional byCodeOptional(String code) {
return Optional.ofNullable(byCode(code));
}
public static String codeToDesciption(String code) {
return byCodeOptional(code).map(c -> c.description).orElse(null);
}
}