DataRegionConfiguration is a FINAL class but could we make it not final?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

DataRegionConfiguration is a FINAL class but could we make it not final?

hlopez
Is there a very good reason why the DataRegionConfiguration is a *FINAL*
class?

I would like to be able to extend the DataRegionConfiguration.

In my extended class I would like to add a new method for the *setMaxSize()*
and *setInitialSize()* for example where the input is of the type
*org.springframework.util.unit.DataSize* instead of *long*.

This way I can do *super.setMaxSize(maxSize.toBytes())* which will convert a
property set in my application.properties in a form like *"1GB"* to the
corresponding bytes by Spring Boot automatically.

see [1]  Properties Conversion
<https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-conversion-datasize>  

[1]
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-conversion-datasize

The only option I have now is to Wrap the class and delegate the methods,
but that makes me create two beans instead of one for each
DataRegionConfiguration.





--
Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: DataRegionConfiguration is a FINAL class but could we make it not final?

Ilya Lantukh-2
Hi,

I couldn't find any strong reason why this class needs to be final. So, if
that is a restriction for you, feel free to create a ticket and submit a
pull request.

On Fri, Mar 15, 2019 at 11:47 PM hlopez <[hidden email]> wrote:

> Is there a very good reason why the DataRegionConfiguration is a *FINAL*
> class?
>
> I would like to be able to extend the DataRegionConfiguration.
>
> In my extended class I would like to add a new method for the
> *setMaxSize()*
> and *setInitialSize()* for example where the input is of the type
> *org.springframework.util.unit.DataSize* instead of *long*.
>
> This way I can do *super.setMaxSize(maxSize.toBytes())* which will convert
> a
> property set in my application.properties in a form like *"1GB"* to the
> corresponding bytes by Spring Boot automatically.
>
> see [1]  Properties Conversion
> <
> https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-conversion-datasize>
>
>
> [1]
>
> https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-conversion-datasize
>
> The only option I have now is to Wrap the class and delegate the methods,
> but that makes me create two beans instead of one for each
> DataRegionConfiguration.
>
>
>
>
>
> --
> Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/
>