public static String toIdentityDocumentData(IdentityDocument identityDocument) {
        IdentityDocumentEntity documentEntity = new IdentityDocumentEntity(
                identityDocument.providerUniqueId().asDottedString(),
                identityDocument.providerService().getFullName(),
                identityDocument.configServerHostname(),
                identityDocument.instanceHostname(),
                identityDocument.createdAt(),
                identityDocument.ipAddresses(),
                identityDocument.identityType().id(),
                Optional.ofNullable(identityDocument.clusterType()).map(ClusterType::toConfigValue).orElse(null),
                identityDocument.ztsUrl().toString(),
                identityDocument.serviceIdentity().getFullName());
        try {
            byte[] bytes = mapper.writeValueAsBytes(documentEntity);
            return Base64.getEncoder().encodeToString(bytes);
        } catch (JsonProcessingException e) {
            throw new RuntimeException("Error during serialization of identity document.", e);
        }
    }
Utility class for mapping objects model types and their Jackson binding versions.

@author bjorncs
@author mortent
vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapper.java