Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Perhaps it happens because you are missing "set configuration", try specifying it explicitly and see if that solves it or a different error happens, e.g.</p> <pre><code>&lt;field custom-converter="com.OnOffEnumToBooleanConverter"&gt; &lt;a&gt;field1&lt;/a&gt; &lt;b get-method="isField2" set-method="field2"&gt;subParent.field2&lt;/b&gt; &lt;/field&gt; </code></pre> <p>UPDATE:</p> <p>I had to properly format your java code to be able to read...here is the problem you have "if and else" for a boolean value...there is no 3rd condition...just carefully look at it:</p> <pre><code>if (src instanceof com.OnOff1BitEnum) { boolean canonicalObject; if ((com.OnOff1BitEnum) src == com.OnOff1BitEnum.ON) { canonicalObject = true; } else { if ((com.OnOff1BitEnum) src == com.OnOff1BitEnum.OFF) { canonicalObject = false; } else { // Unreachable Code To Test throw new MappingException("Converter " + this.getClass().getCanonicalName() + " used incorrectly. Arguments passed in were: " + dest + " and " + src); } } return canonicalObject; } </code></pre> <p>That's the evil of "if else construct" that has no brackets in your original code. Also your "convert" method returns Object...so your "<code>boolean canonicalObject</code>" has to be "<strong>Boolean</strong> canonicalObject" not primitive type.</p> <p>Should be:</p> <pre><code>@Override public Object convert(Object dest, Object src, Class&lt;?&gt; destClass, Class&lt;?&gt; srcClass) { if (src instanceof com.OnOff1BitEnum) { if ((com.OnOff1BitEnum) src == com.OnOff1BitEnum.ON) { return Boolean.TRUE; } else { return Boolean.FALSE; } } return null; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload