Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.digester.plugins.strategies
Class FinderSetProperties

    java.lang.Object
      org.apache.commons.digester.plugins.RuleFinder
          org.apache.commons.digester.plugins.strategies.FinderSetProperties

    public class FinderSetProperties

extends RuleFinder

A rule-finding algorithm which expects the user to specify whether "automatic property setting" is desired. If this class discovers that this is in fact the case for a declaration, then a RuleLoader is returned which, when invoked, adds a single SetPropertiesRule instance to the digester.

This allows ordinary JavaBean classes to be used as plugins, and have xml attributes be mapped to bean properties of the same name, without any custom plugin rules being created for them.

This RuleFinder is typically used as the last RuleFinder, so that automatic property setting only occurs if there is no other source of custom rules available.

Since:
  1.6

Field Summary
`static String` | `DFLT_FALSEVAL`
`static String` | `DFLT_PROPS_ATTR`

Constructor Summary
`FinderSetProperties()` See `findLoader(org.apache.commons.digester.Digester, java.lang.Class, java.util.Properties)`.
`FinderSetProperties(String propsAttr, String falseval)` Create a rule-finder which will arrange for a SetPropertiesRule to be defined for each instance of a plugin, so that xml attributes map to bean properties.

Method Summary
`RuleLoader` | `findLoader(Digester d, Class<?> pluginClass, Properties p)` Returns a RuleLoader unless the properties contain an entry with the name matching constructor param propsAttr, and the value matching what is in falseval.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DFLT_PROPS_ATTR

    public static String DFLT_PROPS_ATTR

### DFLT_FALSEVAL

    public static String DFLT_FALSEVAL

Constructor Detail

### FinderSetProperties

    public FinderSetProperties()

  See `findLoader(org.apache.commons.digester.Digester, java.lang.Class, java.util.Properties)`.

### FinderSetProperties

    public FinderSetProperties(String propsAttr,
                               String falseval)

  Create a rule-finder which will arrange for a SetPropertiesRule to be defined for each instance of a plugin, so that xml attributes map to bean properties.

  Param falseval will commonly be the string "false" for config files written in English.

  Parameters:
    `propsAttr` - must be non-null.
    `falseval` - must be non-null.

Method Detail

### findLoader

    public RuleLoader findLoader(Digester d,
                                 Class<?> pluginClass,
                                 Properties p)

  Returns a RuleLoader unless the properties contain an entry with the name matching constructor param propsAttr, and the value matching what is in falseval.

  If no custom source of rules for a plugin is found, then the user almost always wants xml attributes to map to java bean properties, so this is the default behaviour unless the user explicitly indicates that they do not want a SetPropertiesRule to be provided for the plugged-in class.

  The returned object (when non-null) will add a SetPropertiesRule to the digester whenever its addRules method is invoked.

  Specified by:
    `findLoader` in class `RuleFinder`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2008 The Apache Software Foundation. All Rights Reserved.