From b76b6e6212784d622ca79bd258fa3e529b353346 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 28 Sep 2018 14:19:50 +0200 Subject: add first code for eID4U --- .../MaritalStateAttributeValueMarshaller.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValueMarshaller.java (limited to 'id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValueMarshaller.java') diff --git a/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValueMarshaller.java b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValueMarshaller.java new file mode 100644 index 000000000..afa8d4d06 --- /dev/null +++ b/id/server/modules/eID4UExtensions/src/main/java/at/gv/egiz/eid4u/impl/attributes/natural/MaritalStateAttributeValueMarshaller.java @@ -0,0 +1,26 @@ +package at.gv.egiz.eid4u.impl.attributes.natural; + +import at.gv.egiz.eid4u.api.attributes.natural.MaritalState; +import eu.eidas.auth.commons.attribute.AttributeValue; +import eu.eidas.auth.commons.attribute.AttributeValueMarshaller; +import eu.eidas.auth.commons.attribute.AttributeValueMarshallingException; + +public final class MaritalStateAttributeValueMarshaller implements AttributeValueMarshaller { + + @Override + public String marshal(AttributeValue value) throws AttributeValueMarshallingException { + return value.getValue().getValue(); + + } + + @Override + public AttributeValue unmarshal(String value, boolean isNonLatinScriptAlternateVersion) + throws AttributeValueMarshallingException { + MaritalState idType = MaritalState.fromString(value); + if (null == idType) { + throw new AttributeValueMarshallingException("Illegal MaritalState value \"" + value + "\""); + } + return new MaritalStateAttributeValue(idType); + } + +} -- cgit v1.2.3