ProfilWeblogVokabelnSpielchenQuizBücherwurm gRayman.de

Kategorien

Style

Anzeigen

Alle Einnahmen von den folgenden Anzeigen werden an die Deutsche Krebshilfe gespendet.

RSS 0.91

18. Mai 2004

/java
BeanUtils: InterpolatedPropertyUtils  

[DE]
Eine kleine Erweiterung von ->Jakarta Commons BeanUtils die es ermöglicht Eigenschaften eines Bean als Indizes und/oder Schlüssel in einem indizierten und/oder gemappten Propety-Name usw. zu benutzen.

[UK]
Small extension to ->Jakarta Commons BeanUtils which enables the usage of bean's properties as indexes and/or keys in indexed and/or mapped property names.

Download (Freeware - Apache Software License, Version 2.0)

JavaDoc (part)

de.grayman.commons.beanutils
Class InterpolatedPropertyUtils

java.lang.Object
  +--de.grayman.commons.beanutils.InterpolatedPropertyUtils

public class InterpolatedPropertyUtils
extends java.lang.Object

Similar to PropertyUtils but allows interpolated properties.

The name of a property can contain subexpression eclosed in braces { }. These subexpressions will be evaluated before the value of the PropertyUtils.getProperty(java.lang.Object, java.lang.String) evaluated.

Example:

When a bean has the property index with the value 42 and an indexed property values, then the expression values[{index}] is equivalent to values[42].

The subexpressions itself can be a nested, indexed, mapped or interpolated property. So the following is a valid expression: a.map({c.values[{d.index}]}).

The subexpression does not have to be used as an index or a key, it can also be used as a property name or part thereof: a.{propName} or xy{propName} are valid expressions, as long as the resulting string is a valid expression.

Note: The subexpressions can be nested, but the values of the subexpressions will NOT be recurively interpolated. So, when the property name is "{name}" the evaluation of the expression {name} will not cause a StackOverflowError but return "{name}" instead.

Thanks to Günther H. Zylinski for help and feedback.

1 Kommentar(e) permalink

      Impressum:  Gregor Raýman · Auf dem Kirchbüchel 3 · D-53127 Bonn Kontakt: webmaster@grayman.de         Valid HTML 4.01! Valid HTML 4.01! .