MetaModelServiceDefault implements MetaModelService { @Override public DomainModel getDomainModel() { final Collection<ObjectSpecification> specifications = specificationLoader.snapshotSpecifications(); final List<DomainMember> rows = _Lists.newArrayList(); for (final ObjectSpecification spec : specifications) { if (exclude(spec)) { continue; } { final Stream<ObjectAssociation> properties = spec.streamAssociations(Contributed.EXCLUDED) .filter(ObjectAssociation.Predicates.PROPERTIES); properties .map(property->(OneToOneAssociation) property) .filter(otoa->!exclude(otoa)) .forEach(otoa->rows.add(new DomainMemberDefault(spec, otoa))); } { final Stream<ObjectAssociation> associations = spec.streamAssociations(Contributed.EXCLUDED) .filter(ObjectAssociation.Predicates.COLLECTIONS); associations .map(collection->(OneToManyAssociation) collection) .filter(otma->!exclude(otma)) .forEach(otma->rows.add(new DomainMemberDefault(spec, otma))); } { final Stream<ObjectAction> actions = spec.streamObjectActions(Contributed.INCLUDED); actions .filter(action->!exclude(action)) .forEach(action->rows.add(new DomainMemberDefault(spec, action))); } } Collections.sort(rows); return new DomainModelDefault(rows); }  @PostConstruct void init(); @Override Class<?> fromObjectType(final String objectType); @Override String toObjectType(final Class<?> domainType); @Override void rebuild(final Class<?> domainType); @Override DomainModel getDomainModel(); @Override BeanSort sortOf(
            final Class<?> domainType, final Mode mode); @Override BeanSort sortOf(final Bookmark bookmark, final Mode mode); @Override CommandDtoProcessor commandDtoProcessorFor(final String memberIdentifier); @Override MetamodelDto exportMetaModel(final Config config);  }
@Test @DisplayName("model to XML marshalling should not throw") void model_marshalling() throws JAXBException { DomainModel domainMembers = mockMetaModelService.getDomainModel(); JAXBContext jaxbContext = JAXBContext.newInstance(DomainModelDefault.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); jaxbMarshaller.marshal(domainMembers, noopOutput()); }