OcDublinCoreUtil { public static JaxbOcDublinCore toJaxb(final OcDublinCore source) { final JaxbOcDublinCore target = new JaxbOcDublinCore(); target.abstrakt = source.getAbstract().getOrElseNull(); target.accessRights = source.getAccessRights().getOrElseNull(); target.accrualMethod = source.getAccrualMethod().getOrElseNull(); target.accrualPeriodicity = source.getAccrualPeriodicity().getOrElseNull(); target.accrualPolicy = source.getAccrualPolicy().getOrElseNull(); target.alternative = source.getAlternative().getOrElseNull(); target.audience = source.getAudience().getOrElseNull(); target.available = source.getAvailable().getOrElseNull(); target.bibliographicCitation = source.getBibliographicCitation().getOrElseNull(); target.conformsTo = source.getConformsTo().getOrElseNull(); target.contributor = source.getContributor().getOrElseNull(); target.coverage = source.getCoverage().getOrElseNull(); target.created = source.getCreated(); target.creator = source.getCreator().getOrElseNull(); target.date = source.getDate().getOrElseNull(); target.dateAccepted = source.getDateAccepted().getOrElseNull(); target.dateCopyrighted = source.getDateCopyrighted().getOrElseNull(); target.dateSubmitted = source.getDateSubmitted().getOrElseNull(); target.description = source.getDescription().getOrElseNull(); target.educationLevel = source.getEducationLevel().getOrElseNull(); target.extent = source.getExtent().getOrElseNull(); target.format = source.getFormat().getOrElseNull(); target.hasFormat = source.getHasFormat().getOrElseNull(); target.hasPart = source.getHasPart().getOrElseNull(); target.hasVersion = source.getHasVersion().getOrElseNull(); target.identifier = source.getIdentifier().getOrElseNull(); target.instructionalMethod = source.getInstructionalMethod().getOrElseNull(); target.isFormatOf = source.getIsFormatOf().getOrElseNull(); target.isPartOf = source.getIsPartOf().getOrElseNull(); target.isReferencedBy = source.getIsReferencedBy().getOrElseNull(); target.isReplacedBy = source.getIsReplacedBy().getOrElseNull(); target.isRequiredBy = source.getIsRequiredBy().getOrElseNull(); target.issued = source.getIssued().getOrElseNull(); target.isVersionOf = source.getIsVersionOf().getOrElseNull(); target.language = source.getLanguage().getOrElseNull(); target.license = source.getLicense().getOrElseNull(); target.mediator = source.getMediator().getOrElseNull(); target.medium = source.getMedium().getOrElseNull(); target.modified = source.getModified().getOrElseNull(); target.provenance = source.getProvenance().getOrElseNull(); target.publisher = source.getPublisher().getOrElseNull(); target.references = source.getReferences().getOrElseNull(); target.relation = source.getRelation().getOrElseNull(); target.replaces = source.getReplaces().getOrElseNull(); target.requires = source.getRequires().getOrElseNull(); target.rights = source.getRights().getOrElseNull(); target.rightsHolder = source.getRightsHolder().getOrElseNull(); target.source = source.getSource().getOrElseNull(); target.spatial = source.getSpatial().getOrElseNull(); target.subject = source.getSubject().getOrElseNull(); target.tableOfContents = source.getTableOfContents().getOrElseNull(); target.temporal = source.getTemporal().getOrElseNull(); target.title = source.getTitle(); target.type = source.getType().getOrElseNull(); target.valid = source.getValid().getOrElseNull(); return target; } private  OcDublinCoreUtil(); static DublinCoreValue encodeCreated(Date a); static DublinCoreValue encodeDate(Date a); static DublinCoreValue encodeDateAccepted(Date a); static DublinCoreValue encodeDateCopyrighted(Date a); static DublinCoreValue encodeDateSubmitted(Date a); static DublinCoreValue encodeExtent(Long a); static DublinCoreCatalog toCatalog(final OcDublinCore source); static JaxbOcDublinCore toJaxb(final OcDublinCore source); static final Function<Date, DublinCoreValue> encodeDate; static final Function<Date, DublinCoreValue> encodeDateAccepted; static final Function<Date, DublinCoreValue> encodeDateCopyrighted; static final Function<Date, DublinCoreValue> encodeDateSubmitted; }
@Test public void testToJaxb() throws Exception { final OcDublinCore source = randomDc(); final JaxbOcDublinCore target = OcDublinCoreUtil.toJaxb(source); run(OcDublinCore.class, new OcDublinCore() { @Override public Option<String> getAbstract() { assertEquals("abstract copy", source.getAbstract().getOrElseNull(), target.abstrakt); return null; } @Override public Option<String> getAccessRights() { assertEquals("accessRights copy", source.getAccessRights().getOrElseNull(), target.accessRights); return null; } @Override public Option<String> getAccrualMethod() { assertEquals("accrualMethod copy", source.getAccrualMethod().getOrElseNull(), target.accrualMethod); return null; } @Override public Option<String> getAccrualPeriodicity() { assertEquals("accrualPeriodicity copy", source.getAccrualPeriodicity().getOrElseNull(), target.accrualPeriodicity); return null; } @Override public Option<String> getAccrualPolicy() { assertEquals("accrualPolicy copy", source.getAccrualPolicy().getOrElseNull(), target.accrualPolicy); return null; } @Override public Option<String> getAlternative() { assertEquals("alternative copy", source.getAlternative().getOrElseNull(), target.alternative); return null; } @Override public Option<String> getAudience() { assertEquals("audience copy", source.getAudience().getOrElseNull(), target.audience); return null; } @Override public Option<String> getAvailable() { assertEquals("available copy", source.getAvailable().getOrElseNull(), target.available); return null; } @Override public Option<String> getBibliographicCitation() { assertEquals("bibliographicCitation copy", source.getBibliographicCitation().getOrElseNull(), target.bibliographicCitation); return null; } @Override public Option<String> getConformsTo() { assertEquals("conformsTo copy", source.getConformsTo().getOrElseNull(), target.conformsTo); return null; } @Override public Option<String> getContributor() { assertEquals("contributor copy", source.getContributor().getOrElseNull(), target.contributor); return null; } @Override public Option<String> getCoverage() { assertEquals("coverage copy", source.getCoverage().getOrElseNull(), target.coverage); return null; } @Override public Date getCreated() { assertEquals("created copy", source.getCreated(), target.created); return null; } @Override public Option<String> getCreator() { assertEquals("creator copy", source.getCreator().getOrElseNull(), target.creator); return null; } @Override public Option<Date> getDate() { assertEquals("date copy", source.getDate().getOrElseNull(), target.date); return null; } @Override public Option<Date> getDateAccepted() { assertEquals("dateAccepted copy", source.getDateAccepted().getOrElseNull(), target.dateAccepted); return null; } @Override public Option<Date> getDateCopyrighted() { assertEquals("dateCopyrighted copy", source.getDateCopyrighted().getOrElseNull(), target.dateCopyrighted); return null; } @Override public Option<Date> getDateSubmitted() { assertEquals("dateSubmitted copy", source.getDateSubmitted().getOrElseNull(), target.dateSubmitted); return null; } @Override public Option<String> getDescription() { assertEquals("description copy", source.getDescription().getOrElseNull(), target.description); return null; } @Override public Option<String> getEducationLevel() { assertEquals("educationLevel copy", source.getEducationLevel().getOrElseNull(), target.educationLevel); return null; } @Override public Option<Long> getExtent() { assertEquals("extent copy", source.getExtent().getOrElseNull(), target.extent); return null; } @Override public Option<String> getFormat() { assertEquals("format copy", source.getFormat().getOrElseNull(), target.format); return null; } @Override public Option<String> getHasFormat() { assertEquals("hasFormat copy", source.getHasFormat().getOrElseNull(), target.hasFormat); return null; } @Override public Option<String> getHasPart() { assertEquals("hasPart copy", source.getHasPart().getOrElseNull(), target.hasPart); return null; } @Override public Option<String> getHasVersion() { assertEquals("hasVersion copy", source.getHasVersion().getOrElseNull(), target.hasVersion); return null; } @Override public Option<String> getIdentifier() { assertEquals("identifier copy", source.getIdentifier().getOrElseNull(), target.identifier); return null; } @Override public Option<String> getInstructionalMethod() { assertEquals("instructionalMethod copy", source.getInstructionalMethod().getOrElseNull(), target.instructionalMethod); return null; } @Override public Option<String> getIsFormatOf() { assertEquals("isFormatOf copy", source.getIsFormatOf().getOrElseNull(), target.isFormatOf); return null; } @Override public Option<String> getIsPartOf() { assertEquals("isPartOf copy", source.getIsPartOf().getOrElseNull(), target.isPartOf); return null; } @Override public Option<String> getIsReferencedBy() { assertEquals("isReferencedBy copy", source.getIsReferencedBy().getOrElseNull(), target.isReferencedBy); return null; } @Override public Option<String> getIsReplacedBy() { assertEquals("isReplacedBy copy", source.getIsReplacedBy().getOrElseNull(), target.isReplacedBy); return null; } @Override public Option<String> getIsRequiredBy() { assertEquals("isRequiredBy copy", source.getIsRequiredBy().getOrElseNull(), target.isRequiredBy); return null; } @Override public Option<String> getIssued() { assertEquals("issued copy", source.getIssued().getOrElseNull(), target.issued); return null; } @Override public Option<String> getIsVersionOf() { assertEquals("isVersionOf copy", source.getIsVersionOf().getOrElseNull(), target.isVersionOf); return null; } @Override public Option<String> getLanguage() { assertEquals("language copy", source.getLanguage().getOrElseNull(), target.language); return null; } @Override public Option<String> getLicense() { assertEquals("license copy", source.getLicense().getOrElseNull(), target.license); return null; } @Override public Option<String> getMediator() { assertEquals("mediator copy", source.getMediator().getOrElseNull(), target.mediator); return null; } @Override public Option<String> getMedium() { assertEquals("medium copy", source.getMedium().getOrElseNull(), target.medium); return null; } @Override public Option<String> getModified() { assertEquals("modified copy", source.getModified().getOrElseNull(), target.modified); return null; } @Override public Option<String> getProvenance() { assertEquals("provenance copy", source.getProvenance().getOrElseNull(), target.provenance); return null; } @Override public Option<String> getPublisher() { assertEquals("publisher copy", source.getPublisher().getOrElseNull(), target.publisher); return null; } @Override public Option<String> getReferences() { assertEquals("references copy", source.getReferences().getOrElseNull(), target.references); return null; } @Override public Option<String> getRelation() { assertEquals("relation copy", source.getRelation().getOrElseNull(), target.relation); return null; } @Override public Option<String> getReplaces() { assertEquals("replaces copy", source.getReplaces().getOrElseNull(), target.replaces); return null; } @Override public Option<String> getRequires() { assertEquals("requires copy", source.getRequires().getOrElseNull(), target.requires); return null; } @Override public Option<String> getRights() { assertEquals("rights copy", source.getRights().getOrElseNull(), target.rights); return null; } @Override public Option<String> getRightsHolder() { assertEquals("rightsHolder copy", source.getRightsHolder().getOrElseNull(), target.rightsHolder); return null; } @Override public Option<String> getSource() { assertEquals("source copy", source.getSource().getOrElseNull(), target.source); return null; } @Override public Option<String> getSpatial() { assertEquals("spatial copy", source.getSpatial().getOrElseNull(), target.spatial); return null; } @Override public Option<String> getSubject() { assertEquals("subject copy", source.getSubject().getOrElseNull(), target.subject); return null; } @Override public Option<String> getTableOfContents() { assertEquals("tableOfContents copy", source.getTableOfContents().getOrElseNull(), target.tableOfContents); return null; } @Override public Option<String> getTemporal() { assertEquals("temporal copy", source.getTemporal().getOrElseNull(), target.temporal); return null; } @Override public String getTitle() { assertEquals("title copy", source.getTitle(), target.title); return null; } @Override public Option<String> getType() { assertEquals("type copy", source.getType().getOrElseNull(), target.type); return null; } @Override public Option<String> getValid() { assertEquals("valid copy", source.getValid().getOrElseNull(), target.valid); return null; } }); }