Source:
protected DeploymentDescriptor unmarshal(Path path, DeploymentDescriptorModel model) { if (model == null) { return new DeploymentDescriptorManager().getDefaultDescriptor(); } DeploymentDescriptor updated = new DeploymentDescriptorImpl(); updated.getBuilder() .persistenceUnit(model.getPersistenceUnitName()) .auditPersistenceUnit(model.getAuditPersistenceUnitName()) .auditMode(AuditMode.valueOf(model.getAuditMode())) .persistenceMode(PersistenceMode.valueOf(model.getPersistenceMode())) .runtimeStrategy(RuntimeStrategy.valueOf(model.getRuntimeStrategy())) .setLimitSerializationClasses(model.getLimitSerializationClasses()); List<ItemObjectModel> marshallingStrategies = model.getMarshallingStrategies(); updated.getBuilder().setMarshalingStrategies(processToObjectModel(marshallingStrategies)); List<ItemObjectModel> eventListeners = model.getEventListeners(); updated.getBuilder().setEventListeners(processToObjectModel(eventListeners)); List<ItemObjectModel> globals = model.getGlobals(); updated.getBuilder().setGlobals(processToNamedObjectModel(globals)); List<ItemObjectModel> workItemHandlers = model.getWorkItemHandlers(); updated.getBuilder().setWorkItemHandlers(processToNamedObjectModel(workItemHandlers)); List<ItemObjectModel> taskEventListeners = model.getTaskEventListeners(); updated.getBuilder().setTaskEventListeners(processToObjectModel(taskEventListeners)); List<ItemObjectModel> environmentEntries = model.getEnvironmentEntries(); updated.getBuilder().setEnvironmentEntries(processToNamedObjectModel(environmentEntries)); List<ItemObjectModel> configuration = model.getConfiguration(); updated.getBuilder().setConfiguration(processToNamedObjectModel(configuration)); List<String> roles = new ArrayList<String>(); model.getRequiredRoles().forEach( role ->{ roles.add(role.getValue()); }); updated.getBuilder().setRequiredRoles(model.getRequiredRoles().stream().map( r -> r.getValue()).collect(Collectors.toList())); updated.getBuilder().setClasses(model.getRemotableClasses().stream().map( c -> c.getValue()).collect(Collectors.toList())); return updated; }

Target:
protected DeploymentDescriptor unmarshal(Path path, DeploymentDescriptorModel model) { if (model == null) { return new DeploymentDescriptorManager().getDefaultDescriptor(); } DeploymentDescriptor updated = new DeploymentDescriptorImpl(); updated.getBuilder() .persistenceUnit(model.getPersistenceUnitName()) .auditPersistenceUnit(model.getAuditPersistenceUnitName()) .auditMode(AuditMode.valueOf(model.getAuditMode())) .persistenceMode(PersistenceMode.valueOf(model.getPersistenceMode())) .runtimeStrategy(RuntimeStrategy.valueOf(model.getRuntimeStrategy())) .setLimitSerializationClasses(model.getLimitSerializationClasses()); List<ItemObjectModel> marshallingStrategies = model.getMarshallingStrategies(); updated.getBuilder().setMarshalingStrategies(processToObjectModel(marshallingStrategies)); List<ItemObjectModel> eventListeners = model.getEventListeners(); updated.getBuilder().setEventListeners(processToObjectModel(eventListeners)); List<ItemObjectModel> globals = model.getGlobals(); updated.getBuilder().setGlobals(processToNamedObjectModel(globals)); List<ItemObjectModel> workItemHandlers = model.getWorkItemHandlers(); updated.getBuilder().setWorkItemHandlers(processToNamedObjectModel(workItemHandlers)); List<ItemObjectModel> taskEventListeners = model.getTaskEventListeners(); updated.getBuilder().setTaskEventListeners(processToObjectModel(taskEventListeners)); List<ItemObjectModel> environmentEntries = model.getEnvironmentEntries(); updated.getBuilder().setEnvironmentEntries(processToNamedObjectModel(environmentEntries)); List<ItemObjectModel> configuration = model.getConfiguration(); updated.getBuilder().setConfiguration(processToNamedObjectModel(configuration)); updated.getBuilder().setRequiredRoles(model.getRequiredRoles().stream().map( r -> r.getValue()).collect(Collectors.toList())); updated.getBuilder().setClasses(model.getRemotableClasses().stream().map( c -> c.getValue()).collect(Collectors.toList())); return updated; }