001package gov.nist.secauto.oscal.lib.model; 002 003import gov.nist.secauto.metaschema.core.datatype.adapter.StringAdapter; 004import gov.nist.secauto.metaschema.core.model.IBoundObject; 005import gov.nist.secauto.metaschema.core.model.IMetaschemaData; 006import gov.nist.secauto.metaschema.core.model.constraint.IConstraint; 007import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValue; 008import gov.nist.secauto.metaschema.databind.model.annotations.AllowedValues; 009import gov.nist.secauto.metaschema.databind.model.annotations.BoundFieldValue; 010import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag; 011import gov.nist.secauto.metaschema.databind.model.annotations.Matches; 012import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaField; 013import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints; 014import java.lang.Override; 015import java.lang.String; 016import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 017import org.apache.commons.lang3.builder.ToStringStyle; 018 019/** 020 * 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>. 021 */ 022@MetaschemaField( 023 formalName = "Telephone Number", 024 description = "A telephone service number as defined by [ITU-T E.164](https://www.itu.int/rec/T-REC-E.164-201011-I/en).", 025 name = "telephone-number", 026 moduleClass = OscalMetadataModule.class, 027 valueConstraints = @ValueConstraints(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.")) 028) 029public class TelephoneNumber implements IBoundObject { 030 private final IMetaschemaData __metaschemaData; 031 032 /** 033 * "Indicates the type of phone number." 034 */ 035 @BoundFlag( 036 formalName = "type flag", 037 description = "Indicates the type of phone number.", 038 name = "type", 039 typeAdapter = StringAdapter.class, 040 valueConstraints = @ValueConstraints(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.")})) 041 ) 042 private String _type; 043 044 @BoundFieldValue( 045 valueKeyName = "number" 046 ) 047 private String _number; 048 049 public TelephoneNumber() { 050 this(null); 051 } 052 053 public TelephoneNumber(IMetaschemaData data) { 054 this.__metaschemaData = data; 055 } 056 057 @Override 058 public IMetaschemaData getMetaschemaData() { 059 return __metaschemaData; 060 } 061 062 public String getType() { 063 return _type; 064 } 065 066 public void setType(String value) { 067 _type = value; 068 } 069 070 public String getNumber() { 071 return _number; 072 } 073 074 public void setNumber(String value) { 075 _number = value; 076 } 077 078 @Override 079 public String toString() { 080 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 081 } 082}