super helpful, thank you

On Tuesday, August 2, 2016 at 12:38:57 AM UTC-5, Lukas Eder wrote:
>
> Hello,
>
> There is the possibility of generating custom code sections in POJOs:
> http://www.jooq.org/doc/latest/manual/code-generation/codegen-custom-code
>
> But in your case, that's not going to be sufficient as you want to 
> override setter behaviour. You can still do it, but it's a bit more work. 
> Essentially, you will need to extend the org.jooq.util.JavaGenerator and 
> override the following method:
>
> - org.jooq.util.JavaGenerator.generatePojo(TableDefinition table, 
> JavaWriter out)
>
> Alternatively, you can patch JavaGenerator, of course.
>
> Hope this helps,
> Lukas
>
> 2016-08-01 21:37 GMT+02:00 <[email protected] <javascript:>>:
>
>> Is it possible, via a custom generator strategy or similar, to add custom 
>> logic to pojos?
>>
>> I would like to generate pojos that fire events when properties are 
>> changed. I do _not_ want to extend 'Observable'.
>>
>> Using the old 'PropertyChangeSupport' class as an example...
>>
>>
>>  public final class MyBean {
>>      private final PropertyChangeSupport pcs = new 
>> PropertyChangeSupport(this);
>>
>>      public PropertyChangeSupport getChangeSupport() { return pcs; }
>>
>>      private String value;
>>
>>      public String getValue() {
>>          return this.value;
>>      }
>>
>>      public void setValue(String newValue) {
>>          this.pcs.firePropertyChange("value", oldValue, this.oldValue = 
>> newValue);
>>      }
>>
>>      [...]
>>  }
>>  
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "jOOQ User Group" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to