|
|||||||||||||||||||
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 | |||||||||||||||
StackSetPropertyRule.java | - | 85.7% | 75% | 81.8% |
|
1 |
/*
|
|
2 |
* Joey and its relative products are published under the terms
|
|
3 |
* of the Apache Software License.
|
|
4 |
*/
|
|
5 |
package org.asyrinx.brownie.core.xml.digester;
|
|
6 |
|
|
7 |
import java.lang.reflect.InvocationTargetException;
|
|
8 |
|
|
9 |
import org.apache.commons.beanutils.BeanUtils;
|
|
10 |
import org.apache.commons.digester.Rule;
|
|
11 |
import org.xml.sax.Attributes;
|
|
12 |
|
|
13 |
/**
|
|
14 |
* @author Akima
|
|
15 |
*/
|
|
16 |
public class StackSetPropertyRule extends Rule { |
|
17 |
|
|
18 |
/**
|
|
19 |
* Constructor for StackSetPropertyRule.
|
|
20 |
*/
|
|
21 | 6 |
public StackSetPropertyRule(String propertyName) {
|
22 | 6 |
super();
|
23 | 6 |
this.propertyName = propertyName;
|
24 |
} |
|
25 |
|
|
26 |
private final String propertyName;
|
|
27 |
|
|
28 |
/**
|
|
29 |
* @see org.apache.commons.digester.Rule#begin(org.xml.sax.Attributes)
|
|
30 |
* @deprecated
|
|
31 |
*/
|
|
32 | 0 |
public void begin(Attributes attributes) throws Exception { |
33 | 0 |
execute(); |
34 |
} |
|
35 |
|
|
36 |
/**
|
|
37 |
* @see org.apache.commons.digester.Rule#begin(java.lang.String,
|
|
38 |
* java.lang.String, org.xml.sax.Attributes)
|
|
39 |
*/
|
|
40 | 6 |
public void begin(String namespace, String name, Attributes attributes) throws Exception { |
41 | 6 |
execute(); |
42 |
} |
|
43 |
|
|
44 |
/**
|
|
45 |
* @throws IllegalAccessException
|
|
46 |
* @throws InvocationTargetException
|
|
47 |
*/
|
|
48 | 6 |
private void execute() throws IllegalAccessException, InvocationTargetException { |
49 | 6 |
final Object bean = digester.peek(1); |
50 | 6 |
final Object value = digester.peek(0); |
51 | 6 |
BeanUtils.setProperty(bean, propertyName, value); |
52 |
} |
|
53 |
|
|
54 |
} |
|