@Override public XLink anchor(final MarshalContext context, final Object value, final CharSequence text) { final URI linkage; synchronized (anchors) { linkage = anchors.get(value); } if (linkage != null) { final XLink xlink = new XLink(); xlink.setHRef(linkage); return xlink; } return super.anchor(context, value, text); } });
/** * Returns the {@code xlink}, or {@code null} if none and {@code create} is {@code false}. * If the {@code create} argument is {@code true}, then this method will create the XLink * when first needed. In the later case, any previous {@code gco:nilReason} will be * overwritten since the object is not nil. */ private XLink xlink(final boolean create) { final ObjectReference ref = reference(create); if (ref == null) { return null; } XLink xlink = ref.xlink; if (create && xlink == null) { ref.xlink = xlink = new XLink(); xlink.setType(XLink.Type.SIMPLE); // The "simple" type is fixed in the "gco" schema. } return xlink; }
/** * Returns the {@code xlink}, or {@code null} if none and {@code create} is {@code false}. * If the {@code create} argument is {@code true}, then this method will create the XLink * when first needed. In the later case, any previous {@code gco:nilReason} will be * overwritten since the object is not nil. */ private XLink xlink(final boolean create) { final ObjectReference ref = reference(create); if (ref == null) { return null; } XLink xlink = ref.xlink; if (create && xlink == null) { ref.xlink = xlink = new XLink(); xlink.setType(XLink.Type.SIMPLE); // The "simple" type is fixed in the "gco" schema. } return xlink; }
final XLink link = new XLink(); link.setHRef(href); store(IdentifierSpace.XLINK, link);
final XLink link = new XLink(); link.setHRef(href); store(IdentifierSpace.XLINK, link);
final String id = Context.getObjectID(context, value); if (id != null && resolver.canSubstituteByReference(context, type, value, id)) try { final XLink link = new XLink(); link.setHRef(new URI(null, null, id)); reference = new ObjectReference(null, link);
final String id = Context.getObjectID(context, value); if (id != null && resolver.canSubstituteByReference(context, type, value, id)) try { final XLink link = new XLink(); link.setHRef(new URI(null, null, id)); reference = new ObjectReference(null, link);
/** * Tests (un)marshalling of an object with a {@code xlink:href} attribute without element definition. * The XML fragment is: * * {@preformat xml * <mdb:MD_Metadata> * <mdb:identificationInfo xlink:href="http://test.net"/> * </mdb:MD_Metadata> * } * * @throws JAXBException if an error occurred during (un)marshalling. * @throws URISyntaxException if the URI used in this test is malformed. */ @Test public void testLinkOnly() throws JAXBException, URISyntaxException { final XLink xlink = new XLink(); xlink.setHRef(new URI("http://test.net")); final DefaultDataIdentification identification = new DefaultDataIdentification(); identification.getIdentifierMap().putSpecialized(IdentifierSpace.XLINK, xlink); final DefaultMetadata metadata = new DefaultMetadata(); metadata.setIdentificationInfo(Collections.singleton(identification)); assertXmlEquals(LINK_ONLY_XML, marshal(metadata), "xmlns:*"); verify(true, unmarshal(DefaultMetadata.class, LINK_ONLY_XML)); }
final XLink link = new XLink(); link.setType(XLink.Type.SIMPLE); link.setHRef(new URI("org:apache:sis:href"));
return new SpecializedIdentifier<>(IdentifierSpace.HREF, href); final XLink xlink = new XLink(); xlink.setHRef(href); return new SpecializedIdentifier<>(IdentifierSpace.XLINK, xlink);
return new SpecializedIdentifier<>(IdentifierSpace.HREF, href); final XLink xlink = new XLink(); xlink.setHRef(href); return new SpecializedIdentifier<>(IdentifierSpace.XLINK, xlink);
final XLink xlink = new XLink(); xlink.setHRef(new URI("http://test.net")); final DefaultDataIdentification identification = new DefaultDataIdentification();
final XLink link = new XLink(); link.setShow(XLink.Show.REPLACE); link.setActuate(XLink.Actuate.ON_LOAD);
final XLink link = new XLink(); int hashCode = link.hashCode(); assertFalse(hashCode == 0);