001package com.example.metaschema; 002 003import gov.nist.secauto.metaschema.core.datatype.adapter.NonNegativeIntegerAdapter; 004import gov.nist.secauto.metaschema.core.datatype.adapter.PositiveIntegerAdapter; 005import gov.nist.secauto.metaschema.core.datatype.adapter.StringAdapter; 006import gov.nist.secauto.metaschema.core.datatype.adapter.TokenAdapter; 007import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLine; 008import gov.nist.secauto.metaschema.core.datatype.markup.MarkupLineAdapter; 009import gov.nist.secauto.metaschema.core.model.IBoundObject; 010import gov.nist.secauto.metaschema.core.model.IMetaschemaData; 011import gov.nist.secauto.metaschema.core.model.JsonGroupAsBehavior; 012import gov.nist.secauto.metaschema.core.model.constraint.IConstraint; 013import gov.nist.secauto.metaschema.core.util.ObjectUtils; 014import gov.nist.secauto.metaschema.databind.model.annotations.BoundAssembly; 015import gov.nist.secauto.metaschema.databind.model.annotations.BoundField; 016import gov.nist.secauto.metaschema.databind.model.annotations.BoundFlag; 017import gov.nist.secauto.metaschema.databind.model.annotations.Matches; 018import gov.nist.secauto.metaschema.databind.model.annotations.MetaschemaAssembly; 019import gov.nist.secauto.metaschema.databind.model.annotations.ValueConstraints; 020import java.lang.Override; 021import java.lang.String; 022import java.math.BigInteger; 023import java.util.LinkedList; 024import java.util.List; 025import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 026import org.apache.commons.lang3.builder.ToStringStyle; 027 028@MetaschemaAssembly( 029 formalName = "Assembly Reference", 030 name = "assembly-reference", 031 moduleClass = MetaschemaModelModule.class 032) 033public class AssemblyReference implements IBoundObject { 034 private final IMetaschemaData __metaschemaData; 035 036 @BoundFlag( 037 formalName = "Global Assembly Reference", 038 name = "ref", 039 required = true, 040 typeAdapter = TokenAdapter.class 041 ) 042 private String _ref; 043 044 @BoundFlag( 045 formalName = "Assembly Reference Binary Name", 046 name = "index", 047 typeAdapter = PositiveIntegerAdapter.class 048 ) 049 private BigInteger _index; 050 051 @BoundFlag( 052 formalName = "Deprecated Version", 053 name = "deprecated", 054 typeAdapter = StringAdapter.class 055 ) 056 private String _deprecated; 057 058 @BoundFlag( 059 formalName = "Minimum Occurrence", 060 name = "min-occurs", 061 defaultValue = "0", 062 typeAdapter = NonNegativeIntegerAdapter.class 063 ) 064 private BigInteger _minOccurs; 065 066 @BoundFlag( 067 formalName = "Maximum Occurrence", 068 name = "max-occurs", 069 defaultValue = "1", 070 typeAdapter = StringAdapter.class, 071 valueConstraints = @ValueConstraints(matches = @Matches(level = IConstraint.Level.ERROR, pattern = "^[1-9][0-9]*|unbounded$")) 072 ) 073 private String _maxOccurs; 074 075 @BoundField( 076 formalName = "Formal Name", 077 description = "A formal name for the data construct, to be presented in documentation.", 078 useName = "formal-name" 079 ) 080 private String _formalName; 081 082 @BoundField( 083 formalName = "Description", 084 description = "A short description of the data construct's purpose, describing the constructs semantics.", 085 useName = "description", 086 typeAdapter = MarkupLineAdapter.class 087 ) 088 private MarkupLine _description; 089 090 @BoundAssembly( 091 formalName = "Property", 092 useName = "prop", 093 maxOccurs = -1, 094 groupAs = @gov.nist.secauto.metaschema.databind.model.annotations.GroupAs(name = "props", inJson = JsonGroupAsBehavior.LIST) 095 ) 096 private List<Property> _props; 097 098 @BoundField( 099 formalName = "Use Name", 100 description = "Allows the name of the definition to be overridden.", 101 useName = "use-name" 102 ) 103 private UseName _useName; 104 105 @BoundAssembly( 106 formalName = "Group As", 107 useName = "group-as" 108 ) 109 private GroupAs _groupAs; 110 111 @BoundField( 112 formalName = "Remarks", 113 description = "Any explanatory or helpful information to be provided about the remarks parent.", 114 useName = "remarks" 115 ) 116 private Remarks _remarks; 117 118 public AssemblyReference() { 119 this(null); 120 } 121 122 public AssemblyReference(IMetaschemaData data) { 123 this.__metaschemaData = data; 124 } 125 126 @Override 127 public IMetaschemaData getMetaschemaData() { 128 return __metaschemaData; 129 } 130 131 public String getRef() { 132 return _ref; 133 } 134 135 public void setRef(String value) { 136 _ref = value; 137 } 138 139 public BigInteger getIndex() { 140 return _index; 141 } 142 143 public void setIndex(BigInteger value) { 144 _index = value; 145 } 146 147 public String getDeprecated() { 148 return _deprecated; 149 } 150 151 public void setDeprecated(String value) { 152 _deprecated = value; 153 } 154 155 public BigInteger getMinOccurs() { 156 return _minOccurs; 157 } 158 159 public void setMinOccurs(BigInteger value) { 160 _minOccurs = value; 161 } 162 163 public String getMaxOccurs() { 164 return _maxOccurs; 165 } 166 167 public void setMaxOccurs(String value) { 168 _maxOccurs = value; 169 } 170 171 public String getFormalName() { 172 return _formalName; 173 } 174 175 public void setFormalName(String value) { 176 _formalName = value; 177 } 178 179 public MarkupLine getDescription() { 180 return _description; 181 } 182 183 public void setDescription(MarkupLine value) { 184 _description = value; 185 } 186 187 public List<Property> getProps() { 188 return _props; 189 } 190 191 public void setProps(List<Property> value) { 192 _props = value; 193 } 194 195 /** 196 * Add a new {@link Property} item to the underlying collection. 197 * @param item the item to add 198 * @return {@code true} 199 */ 200 public boolean addProp(Property item) { 201 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 202 if (_props == null) { 203 _props = new LinkedList<>(); 204 } 205 return _props.add(value); 206 } 207 208 /** 209 * Remove the first matching {@link Property} item from the underlying collection. 210 * @param item the item to remove 211 * @return {@code true} if the item was removed or {@code false} otherwise 212 */ 213 public boolean removeProp(Property item) { 214 Property value = ObjectUtils.requireNonNull(item,"item cannot be null"); 215 return _props != null && _props.remove(value); 216 } 217 218 public UseName getUseName() { 219 return _useName; 220 } 221 222 public void setUseName(UseName value) { 223 _useName = value; 224 } 225 226 public GroupAs getGroupAs() { 227 return _groupAs; 228 } 229 230 public void setGroupAs(GroupAs value) { 231 _groupAs = value; 232 } 233 234 public Remarks getRemarks() { 235 return _remarks; 236 } 237 238 public void setRemarks(Remarks value) { 239 _remarks = value; 240 } 241 242 @Override 243 public String toString() { 244 return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).toString(); 245 } 246}