PINCompareMarkerType { public PINCompareMarkerType(iso.std.iso_iec._24727.tech.schema.DIDAbstractMarkerType didAbstractMarkerType) { protocol = didAbstractMarkerType.getProtocol(); if (! protocol.equals("urn:oid:1.3.162.15480.3.0.9")) { throw new IllegalArgumentException(); } for (Element e : didAbstractMarkerType.getAny()) { if (e.getLocalName().equals("PinRef")) { pinRef = new KeyRefType(); NodeList nodeList = e.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node n = nodeList.item(i); if (n.getNodeType() != Node.ELEMENT_NODE) { continue; } else if (n.getLocalName().equals("KeyRef")) { pinRef.setKeyRef(StringUtils.toByteArray(n.getTextContent())); } else if (n.getLocalName().equals("Protected")) { pinRef.setProtected(Boolean.parseBoolean(n.getTextContent())); } } } else if (e.getLocalName().equals("PinValue")) { pinValue = e.getTextContent(); } else if (e.getLocalName().equals("PasswordAttributes")) { passwordAttributes = new PasswordAttributesType(); NodeList nodeList = e.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node n = nodeList.item(i); if (n.getNodeType() != Node.ELEMENT_NODE) { continue; } else if (n.getLocalName().equals("pwdFlags")) { passwordAttributes.getPwdFlags().addAll(Arrays.asList(n.getTextContent().split(" "))); } else if (n.getLocalName().equals("pwdType")) { passwordAttributes.setPwdType(PasswordTypeType.fromValue(n.getTextContent())); } else if (n.getLocalName().equals("minLength")) { passwordAttributes.setMinLength(new BigInteger(n.getTextContent())); } else if (n.getLocalName().equals("maxLength")) { passwordAttributes.setMaxLength(new BigInteger(n.getTextContent())); } else if (n.getLocalName().equals("storedLength")) { passwordAttributes.setStoredLength(new BigInteger(n.getTextContent())); } else if (n.getLocalName().equals("padChar")) { passwordAttributes.setPadChar(StringUtils.toByteArray(n.getTextContent())); } } } else if (e.getLocalName().equals("StateInfo")) { } } } PINCompareMarkerType(iso.std.iso_iec._24727.tech.schema.DIDAbstractMarkerType didAbstractMarkerType); KeyRefType getPINRef(); String getPINValue(); PasswordAttributesType getPasswordAttributes(); String getProtocol(); StateInfoType getStateInfo();  }
@Test public void testPinCompareMarkerType() throws Exception { JAXBContext ctx = JAXBContext.newInstance(PinCompareMarkerType.class); Unmarshaller um = ctx.createUnmarshaller(); InputStream res = getClass().getResourceAsStream("/anytype/pin/egk_pin_home_marker.xml"); JAXBElement<PinCompareMarkerType> elem = um.unmarshal(new StreamSource(res), PinCompareMarkerType.class); PINCompareMarkerType pinCompareMarker = new PINCompareMarkerType(elem.getValue()); assertEquals(pinCompareMarker.getPINRef().getKeyRef(), new byte[] { 0x02 }); assertNull(pinCompareMarker.getPINValue()); assertEquals(pinCompareMarker.getPasswordAttributes().getMaxLength(), new BigInteger("8")); assertEquals(pinCompareMarker.getProtocol(), ECardConstants.Protocol.PIN_COMPARE); }