com.github.nagyesta.lowkeyvault.mapper.v7_2.key.KeyEntityToV72PropertiesModelConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lowkey-vault-app Show documentation
Show all versions of lowkey-vault-app Show documentation
Assembled application of Lowkey Vault.
package com.github.nagyesta.lowkeyvault.mapper.v7_2.key;
import com.github.nagyesta.lowkeyvault.context.ApiVersionAware;
import com.github.nagyesta.lowkeyvault.mapper.common.AliasAwareConverter;
import com.github.nagyesta.lowkeyvault.mapper.common.BasePropertiesModelConverter;
import com.github.nagyesta.lowkeyvault.mapper.common.registry.KeyConverterRegistry;
import com.github.nagyesta.lowkeyvault.model.v7_2.key.KeyPropertiesModel;
import com.github.nagyesta.lowkeyvault.service.key.ReadOnlyKeyVaultKeyEntity;
import com.github.nagyesta.lowkeyvault.service.key.id.VersionedKeyEntityId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.lang.NonNull;
import java.net.URI;
import java.util.SortedSet;
public class KeyEntityToV72PropertiesModelConverter
extends BasePropertiesModelConverter
implements AliasAwareConverter {
private final KeyConverterRegistry registry;
@Autowired
public KeyEntityToV72PropertiesModelConverter(@lombok.NonNull final KeyConverterRegistry registry) {
this.registry = registry;
}
@Override
public void afterPropertiesSet() {
registry.registerPropertiesConverter(this);
}
@Override
@NonNull
public KeyPropertiesModel convert(
@org.springframework.lang.NonNull final ReadOnlyKeyVaultKeyEntity source,
@org.springframework.lang.NonNull final URI vaultUri) {
return mapCommonFields(source, new KeyPropertiesModel());
}
@Override
public SortedSet supportedVersions() {
return ApiVersionAware.ALL_VERSIONS;
}
}