final Class<T> clazzT = (Class<T>) value.getClass(); return TenantConfigurationValue.<T> builder().global(false).createdBy(updatedTenantConfiguration.getCreatedBy()) .createdAt(updatedTenantConfiguration.getCreatedAt()) .lastModifiedAt(updatedTenantConfiguration.getLastModifiedAt()) .lastModifiedBy(updatedTenantConfiguration.getLastModifiedBy()) .value(conversionService.convert(updatedTenantConfiguration.getValue(), clazzT)).build();
final Class<T> clazzT = (Class<T>) value.getClass(); return TenantConfigurationValue.<T> builder().global(false).createdBy(updatedTenantConfiguration.getCreatedBy()) .createdAt(updatedTenantConfiguration.getCreatedAt()) .lastModifiedAt(updatedTenantConfiguration.getLastModifiedAt()) .lastModifiedBy(updatedTenantConfiguration.getLastModifiedBy()) .value(conversionService.convert(updatedTenantConfiguration.getValue(), clazzT)).build();
@Override public <T extends Serializable> TenantConfigurationValue<T> buildTenantConfigurationValueByKey( final TenantConfigurationKey configurationKey, final Class<T> propertyType, final TenantConfiguration tenantConfiguration) { if (tenantConfiguration != null) { return TenantConfigurationValue.<T> builder().global(false).createdBy(tenantConfiguration.getCreatedBy()) .createdAt(tenantConfiguration.getCreatedAt()) .lastModifiedAt(tenantConfiguration.getLastModifiedAt()) .lastModifiedBy(tenantConfiguration.getLastModifiedBy()) .value(conversionService.convert(tenantConfiguration.getValue(), propertyType)).build(); } else if (configurationKey.getDefaultValue() != null) { return TenantConfigurationValue.<T> builder().global(true).createdBy(null).createdAt(null) .lastModifiedAt(null).lastModifiedBy(null) .value(getGlobalConfigurationValue(configurationKey.getKeyName(), propertyType)).build(); } return null; }
@Override public <T extends Serializable> TenantConfigurationValue<T> buildTenantConfigurationValueByKey( final TenantConfigurationKey configurationKey, final Class<T> propertyType, final TenantConfiguration tenantConfiguration) { if (tenantConfiguration != null) { return TenantConfigurationValue.<T> builder().global(false).createdBy(tenantConfiguration.getCreatedBy()) .createdAt(tenantConfiguration.getCreatedAt()) .lastModifiedAt(tenantConfiguration.getLastModifiedAt()) .lastModifiedBy(tenantConfiguration.getLastModifiedBy()) .value(conversionService.convert(tenantConfiguration.getValue(), propertyType)).build(); } else if (configurationKey.getDefaultValue() != null) { return TenantConfigurationValue.<T> builder().global(true).createdBy(null).createdAt(null) .lastModifiedAt(null).lastModifiedBy(null) .value(getGlobalConfigurationValue(configurationKey.getKeyName(), propertyType)).build(); } return null; }
/** * Builder. * * @param <K> * the key type * @return the tenant configuration value builder */ public static <K extends Serializable> TenantConfigurationValueBuilder<K> builder() { return new TenantConfigurationValueBuilder<>(); }