|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
PushPropertyRule.java | - | 85.7% | 75% | 81.8% |
|
1 |
/*
|
|
2 |
* brownies and its relative products are published under the terms
|
|
3 |
* of the Apache Software License.
|
|
4 |
*
|
|
5 |
* Created on 2004/08/12 17:17:03
|
|
6 |
*/
|
|
7 |
package org.asyrinx.brownie.core.xml.digester;
|
|
8 |
|
|
9 |
import java.lang.reflect.InvocationTargetException;
|
|
10 |
|
|
11 |
import org.apache.commons.beanutils.PropertyUtils;
|
|
12 |
import org.apache.commons.digester.Rule;
|
|
13 |
import org.xml.sax.Attributes;
|
|
14 |
|
|
15 |
/**
|
|
16 |
* @author akima
|
|
17 |
*/
|
|
18 |
public class PushPropertyRule extends Rule { |
|
19 |
|
|
20 |
/**
|
|
21 |
* Constructor for StackSetPropertyRule.
|
|
22 |
*/
|
|
23 | 1 |
public PushPropertyRule(String propertyName) {
|
24 | 1 |
super();
|
25 | 1 |
this.propertyName = propertyName;
|
26 |
} |
|
27 |
|
|
28 |
private final String propertyName;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* @see org.apache.commons.digester.Rule#begin(org.xml.sax.Attributes)
|
|
32 |
* @deprecated
|
|
33 |
*/
|
|
34 | 0 |
public void begin(Attributes attributes) throws Exception { |
35 | 0 |
execute(); |
36 |
} |
|
37 |
|
|
38 |
/**
|
|
39 |
* @see org.apache.commons.digester.Rule#begin(java.lang.String,
|
|
40 |
* java.lang.String, org.xml.sax.Attributes)
|
|
41 |
*/
|
|
42 | 1 |
public void begin(String namespace, String name, Attributes attributes) throws Exception { |
43 | 1 |
execute(); |
44 |
} |
|
45 |
|
|
46 |
/**
|
|
47 |
* @throws NoSuchMethodException
|
|
48 |
* @throws InvocationTargetException
|
|
49 |
* @throws IllegalAccessException
|
|
50 |
*/
|
|
51 | 1 |
private void execute() throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { |
52 | 1 |
final Object bean = digester.peek(0); |
53 | 1 |
final Object pushed = PropertyUtils.getProperty(bean, this.propertyName);
|
54 | 1 |
digester.push(pushed); |
55 |
} |
|
56 |
} |
|