Composite attribute
Attribute type id | Type specific restriction parameters |
---|---|
composite | No restrictions. Each sub-attribute of composite attribute can have itβs own restrictions. |
Sub-attributes are presented in the order they are defined in the composite.
Code Examples:
{
"id" : "ADDRESS",
"name" : "Address",
"type" : {
"id" : "composite",
"restriction" : { }
},
"attributeLinks" : [ {
"id" : "ADDRESS_LINE_1",
"appliesTo" : "ALL"
}, {
"id" : "ADDRESS_LINE_2",
"optional" : true,
"appliesTo" : "ALL"
}, {
"id" : "COUNTRY",
"appliesTo" : "ALL"
}, {
"id" : "ZIP_CODE",
"appliesTo" : "ALL"
} ]
}
Attribute compositeAttribute = AttributeBuilder.compositeAttribute("ADDRESS", "Address")
.withChildAttribute(AttributeBuilder.stringAttribute("ADDRESS_LINE_1", "Line 1").build(), false)
.withChildAttribute(AttributeBuilder.stringAttribute("ADDRESS_LINE_2", "Line 2").build(), true)
.withChildAttributes(List.of(AttributeBuilder.stringAttribute("COUNTRY", "Country").build(),
AttributeBuilder.stringAttribute("ZIP_CODE", "Zip code").build()), false)
.build();
Updated over 1 year ago