nbrugger-tgm / reactj

A reactive ui lib for easy MVC
LaTeX Project Public License v1.3c
10 stars 0 forks source link

[Feature] Read Interceptor #23

Closed nbrugger-tgm closed 3 years ago

nbrugger-tgm commented 4 years ago

Read interceptor

It would be nice to have an Observer that does not intercept changes in the model but intercepts read accesses

Example

ReactiveReadModel<Data> d = ReadProxy.create(Data.class);
d.bind("random", () -> new Random().nextInt(19));
d.bind(property     -> "Some lame "+property);

for(int i = 0;i<5;i++){
    System.out.println("Random : " + d.getRandom());
    System.out.println("Age    : " + d.getAge());
}

output:

Random : 8
Age        : some lame age
Random : 2
Age        : some lame age
Random : 5
Age        : some lame age  
....
nbrugger-tgm commented 3 years ago

Canceled

I decided against this idea because

  1. There are libraries like Mockinto or other Mocking libs that do essentialy the same thing
  2. This feature doesn't really adds to this library
  3. The feature doesn't fits into the theme and use case of this lib