001// Generated from: ../../../../../../../../oscal/src/metaschema/oscal_metadata_metaschema.xml 002// Do not edit - changes will be lost when regenerated. 003package dev.metaschema.oscal.lib.model; 004 005import dev.metaschema.core.datatype.adapter.StringAdapter; 006import dev.metaschema.core.model.IBoundObject; 007import dev.metaschema.core.model.IMetaschemaData; 008import dev.metaschema.core.model.constraint.IConstraint; 009import dev.metaschema.core.util.ObjectUtils; 010import dev.metaschema.databind.model.annotations.AllowedValue; 011import dev.metaschema.databind.model.annotations.AllowedValues; 012import dev.metaschema.databind.model.annotations.BoundFieldValue; 013import dev.metaschema.databind.model.annotations.BoundFlag; 014import dev.metaschema.databind.model.annotations.Matches; 015import dev.metaschema.databind.model.annotations.MetaschemaField; 016import dev.metaschema.databind.model.annotations.ValueConstraints; 017import edu.umd.cs.findbugs.annotations.Nullable; 018import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 019import org.apache.commons.lang3.builder.ToStringStyle; 020 021/** 022 * 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>. 023 */ 024@MetaschemaField( 025 formalName = "Telephone Number", 026 description = "A telephone service number as defined by [ITU-T E.164](https://www.itu.int/rec/T-REC-E.164-201011-I/en).", 027 name = "telephone-number", 028 moduleClass = OscalMetadataModule.class, 029 valueConstraints = @ValueConstraints(matches = @Matches(id = "oscal-metadata-telephone-number-regex", 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.")) 030) 031public class TelephoneNumber implements IBoundObject { 032 private final IMetaschemaData __metaschemaData; 033 034 /** 035 * Indicates the type of phone number. 036 */ 037 @BoundFlag( 038 formalName = "type flag", 039 description = "Indicates the type of phone number.", 040 name = "type", 041 typeAdapter = StringAdapter.class, 042 valueConstraints = @ValueConstraints(allowedValues = @AllowedValues(id = "oscal-metadata-telephone-number-type-values", 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.")})) 043 ) 044 private String _type; 045 046 /** 047 * The field value. 048 */ 049 @BoundFieldValue( 050 valueKeyName = "number" 051 ) 052 private String _number; 053 054 /** 055 * Constructs a new {@code dev.metaschema.oscal.lib.model.TelephoneNumber} instance with no metadata. 056 */ 057 public TelephoneNumber() { 058 this(null); 059 } 060 061 /** 062 * Constructs a new {@code dev.metaschema.oscal.lib.model.TelephoneNumber} instance with the specified metadata. 063 * 064 * @param data 065 * the metaschema data, or {@code null} if none 066 */ 067 public TelephoneNumber(IMetaschemaData data) { 068 this.__metaschemaData = data; 069 } 070 071 @Override 072 public IMetaschemaData getMetaschemaData() { 073 return __metaschemaData; 074 } 075 076 /** 077 * Get the "{@literal type flag}". 078 * 079 * <p> 080 * Indicates the type of phone number. 081 * 082 * @return the type value, or {@code null} if not set 083 */ 084 @Nullable 085 public String getType() { 086 return _type; 087 } 088 089 /** 090 * Set the "{@literal type flag}". 091 * 092 * <p> 093 * Indicates the type of phone number. 094 * 095 * @param value 096 * the type value to set, or {@code null} to clear 097 */ 098 public void setType(@Nullable String value) { 099 _type = value; 100 } 101 102 /** 103 * Get the field value. 104 * 105 * @return the value 106 */ 107 @Nullable 108 public String getNumber() { 109 return _number; 110 } 111 112 /** 113 * Set the field value. 114 * 115 * @param value 116 * the value to set 117 */ 118 public void setNumber(@Nullable String value) { 119 _number = value; 120 } 121 122 @Override 123 public String toString() { 124 return ObjectUtils.notNull(new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString()); 125 } 126}