Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Binding to any property using any method is possible and quite easy if you create your custom ELResolver (<a href="http://download.oracle.com/javaee/5/api/javax/el/ELResolver.html" rel="nofollow">apidocs</a>). elresolvers are registered in faces config, and they are responsible, given an Object and a String defining a property, for determining the value and type of the given properties (and, as the need arises, to change it).</p> <p>You could easily write your own ELResolver that would only work for your chosen, single type, and use (for example in a switch statement) the specific methods you need to write and read properties. And for other types it would delegate resolving up the resolver chain. It's really easy to do, much easier than it sounds.</p> <p>But don't do it. The standard naming pattern of properties predates EL by many years. It is part of the JavaBeans™ standard - one of the very few undisputed standards in Javaland, working everywhere - from ant scripts, through spring configuration files to JSF. Seeing methods isPerson and getPerson in one class actually makes me fill uneasy, as it breaks something I always take for granted and can always count on.</p> <p>If you like DDD and want to have your method's names pure, use an adapter. It's easy, fun, and gives a couple of additional lines, which is not something to sneer at if you get paid for the ammount of code produced:</p> <pre><code>public class MyNotReallyBean { public String checkName() { ... } public String lookUpLastName() { ... } public String carefullyAskAboutAge() { ... } public class BeanAdapter { public String getName() { return checkName(); } public String getLastName() { return lookUpLastName(); } public String getAge() { return carefullyAskAboutAge(); } } private static BeanAdapter beanAdapter = new BeanAdapter(); private BeanAdapter getBeanAdapter(){ return beanAdapter; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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