public class AttributeUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends XMLObject> |
addAttributeValue(Attribute attribute,
T value)
Utility method that adds an XML object as a value to an
Attribute . |
static Attribute |
createAttribute(String name,
String friendlyName)
Creates an
Attribute with the given name (and friendly name) and with a name format of
. |
static Attribute |
createAttribute(String name,
String friendlyName,
String nameFormat)
Utility method that creates an
Attribute given its name, friendly name and name format. |
static <T extends XMLObject> |
createAttributeValueObject(Class<T> clazz)
Creates an
AttributeValue object of the given class. |
static <T extends XMLObject> |
createAttributeValueObject(QName schemaType,
Class<T> clazz)
Creates an
AttributeValue object of the given class and schema type. |
public static Attribute createAttribute(String name, String friendlyName, String nameFormat)
Attribute
given its name, friendly name and name format.name
- the attribute namefriendlyName
- the attribute friendly name (may be null
)nameFormat
- the name formatAttribute
objectpublic static Attribute createAttribute(String name, String friendlyName)
Attribute
with the given name (and friendly name) and with a name format of
.name
- the attribute namefriendlyName
- the attribute friendly name (may be null
)Attribute
objectcreateAttribute(String, String, String)
public static <T extends XMLObject> T createAttributeValueObject(Class<T> clazz)
AttributeValue
object of the given class. The type of the attribute value will be the field that
is declared as TYPE_NAME
of the given class.
After the object has been constructed, its setter methods should be called to setup the value object before adding it to the attribute itself.
T
- the typeclazz
- the type of attribute valuecreateAttributeValueObject(QName, Class)
public static <T extends XMLObject> T createAttributeValueObject(QName schemaType, Class<T> clazz)
AttributeValue
object of the given class and schema type.
After the object has been constructed, its setter methods should be called to setup the value object before adding it to the attribute itself.
T
- the typeschemaType
- the schema type that should be assigned to the attribute value, i.e.,
xsi:type="eidas:CurrentFamilyNameType"
clazz
- the type of the attribute valuecreateAttributeValueObject(Class)
public static <T extends XMLObject> void addAttributeValue(Attribute attribute, T value)
Attribute
.
Example:
Attribute attr =
AttributeUtils.createAttribute("http://eidas.europa.eu/attributes/naturalperson/CurrentFamilyName", "FamilyName");
CurrentFamilyNameType value = AttributeUtils.createAttributeValueObject(CurrentFamilyNameType.class);
value.setValue("Lindström");
AttributeUtils.addAttributeValue(attr, value);
T
- the typeattribute
- the attribute to updatevalue
- the value to addCopyright © 2018 Litsec AB. All rights reserved.