View Javadoc
1   package gov.nist.secauto.oscal.lib.model;
2   
3   import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValue;
4   import gov.nist.secauto.metaschema.binding.model.annotations.AllowedValues;
5   import gov.nist.secauto.metaschema.binding.model.annotations.BoundFlag;
6   import gov.nist.secauto.metaschema.binding.model.annotations.Matches;
7   import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaField;
8   import gov.nist.secauto.metaschema.binding.model.annotations.MetaschemaFieldValue;
9   import gov.nist.secauto.metaschema.binding.model.annotations.ValueConstraints;
10  import gov.nist.secauto.metaschema.model.common.constraint.IConstraint;
11  import gov.nist.secauto.metaschema.model.common.datatype.adapter.StringAdapter;
12  import java.lang.Override;
13  import java.lang.String;
14  import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle;
15  import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
16  
17  /**
18   * A telephone service number as defined by <a href="https://www.itu.int/rec/T-REC-E.164-201011-I/en">ITU-T E.164</a>.
19   */
20  @MetaschemaField(
21      formalName = "Telephone Number",
22      description = "A telephone service number as defined by [ITU-T E.164](https://www.itu.int/rec/T-REC-E.164-201011-I/en).",
23      name = "telephone-number",
24      metaschema = OscalMetadataMetaschema.class,
25      isCollapsible = false
26  )
27  @ValueConstraints(
28      matches = @Matches(level = IConstraint.Level.WARNING, pattern = "^[0-9]{3}[0-9]{1,12}$", remarks = "Providing a country code provides an international means to interpret the phone number.")
29  )
30  public class TelephoneNumber {
31    @MetaschemaFieldValue(
32        valueKeyName = "number"
33    )
34    private String _value;
35  
36    @BoundFlag(
37        formalName = "type flag",
38        description = "Indicates the type of phone number.",
39        useName = "type",
40        typeAdapter = StringAdapter.class
41    )
42    @ValueConstraints(
43        allowedValues = @AllowedValues(level = IConstraint.Level.ERROR, allowOthers = true, values = {@AllowedValue(value = "home", description = "A home phone number."), @AllowedValue(value = "office", description = "An office phone number."), @AllowedValue(value = "mobile", description = "A mobile phone number.")})
44    )
45    private String _type;
46  
47    public TelephoneNumber() {
48    }
49  
50    public String getValue() {
51      return _value;
52    }
53  
54    public void setValue(String value) {
55      _value = value;
56    }
57  
58    public String getType() {
59      return _type;
60    }
61  
62    public void setType(String value) {
63      _type = value;
64    }
65  
66    @Override
67    public String toString() {
68      return new ReflectionToStringBuilder(this, MultilineRecursiveToStringStyle.MULTI_LINE_STYLE).toString();
69    }
70  }