xref: /aosp_15_r20/external/cldr/tools/cldr-code/src/main/java/org/unicode/cldr/test/CheckForInheritanceMarkers.java (revision 912701f9769bb47905792267661f0baf2b85bed5)
1 package org.unicode.cldr.test;
2 
3 import java.util.List;
4 import org.unicode.cldr.test.CheckCLDR.CheckStatus.Subtype;
5 import org.unicode.cldr.util.CldrUtility;
6 
7 public class CheckForInheritanceMarkers extends CheckCLDR {
8 
9     @Override
handleCheck( String path, String fullPath, String value, Options options, List<CheckStatus> result)10     public CheckCLDR handleCheck(
11             String path, String fullPath, String value, Options options, List<CheckStatus> result) {
12         if (value == null) {
13             return this;
14         }
15         if (!accept(result)) return this;
16 
17         if (value.contains(CldrUtility.INHERITANCE_MARKER)) {
18             result.add(
19                     new CheckStatus()
20                             .setCause(this)
21                             .setMainType(CheckStatus.errorType)
22                             .setSubtype(Subtype.inheritanceMarkerNotAllowed)
23                             .setMessage(
24                                     "Inheritance marker "
25                                             + CldrUtility.INHERITANCE_MARKER
26                                             + " not allowed in a data value."));
27         }
28         return this;
29     }
30 }
31