Modified:
websites/production/commons/content/proper/commons-beanutils/jacoco/org.apache.commons.beanutils2/PropertyUtilsBean.java.html
==============================================================================
---
websites/production/commons/content/proper/commons-beanutils/jacoco/org.apache.commons.beanutils2/PropertyUtilsBean.java.html
(original)
+++
websites/production/commons/content/proper/commons-beanutils/jacoco/org.apache.commons.beanutils2/PropertyUtilsBean.java.html
Tue Jan 7 19:57:26 2025
@@ -70,7 +70,7 @@ import org.apache.commons.logging.LogFac
public class PropertyUtilsBean {
/** Log instance */
-<span class="nc" id="L73"> private static final Log LOG =
LogFactory.getLog(PropertyUtilsBean.class);</span>
+<span class="fc" id="L73"> private static final Log LOG =
LogFactory.getLog(PropertyUtilsBean.class);</span>
/**
* Gets the PropertyUtils bean instance.
@@ -78,7 +78,7 @@ public class PropertyUtilsBean {
* @return The PropertyUtils bean instance
*/
protected static PropertyUtilsBean getInstance() {
-<span class="nc" id="L81"> return
BeanUtilsBean.getInstance().getPropertyUtils();</span>
+<span class="fc" id="L81"> return
BeanUtilsBean.getInstance().getPropertyUtils();</span>
}
/**
@@ -91,7 +91,7 @@ public class PropertyUtilsBean {
@SuppressWarnings("unchecked")
private static List<Object> toObjectList(final Object obj) {
// indexed properties are stored in lists of objects
-<span class="nc" id="L94"> return (List<Object>) obj;</span>
+<span class="fc" id="L94"> return (List<Object>) obj;</span>
}
/**
@@ -104,10 +104,10 @@ public class PropertyUtilsBean {
@SuppressWarnings("unchecked")
private static Map<String, Object> toPropertyMap(final Object obj) {
// mapped properties are stores in maps of type <String, Object>
-<span class="nc" id="L107"> return (Map<String, Object>)
obj;</span>
+<span class="fc" id="L107"> return (Map<String, Object>)
obj;</span>
}
-<span class="nc" id="L110"> private Resolver resolver = new
DefaultResolver();</span>
+<span class="fc" id="L110"> private Resolver resolver = new
DefaultResolver();</span>
/**
* The cache of PropertyDescriptor arrays for beans we have already
introspected, keyed by the java.lang.Class of this object.
@@ -120,12 +120,12 @@ public class PropertyUtilsBean {
private final List<BeanIntrospector> introspectors;
/** Base constructor */
-<span class="nc" id="L123"> public PropertyUtilsBean() {</span>
-<span class="nc" id="L124"> descriptorsCache =
BeanUtils.createCache();</span>
-<span class="nc" id="L125"> mappedDescriptorsCache =
BeanUtils.createCache();</span>
-<span class="nc" id="L126"> introspectors = new
CopyOnWriteArrayList<>();</span>
-<span class="nc" id="L127"> resetBeanIntrospectors();</span>
-<span class="nc" id="L128"> }</span>
+<span class="fc" id="L123"> public PropertyUtilsBean() {</span>
+<span class="fc" id="L124"> descriptorsCache =
BeanUtils.createCache();</span>
+<span class="fc" id="L125"> mappedDescriptorsCache =
BeanUtils.createCache();</span>
+<span class="fc" id="L126"> introspectors = new
CopyOnWriteArrayList<>();</span>
+<span class="fc" id="L127"> resetBeanIntrospectors();</span>
+<span class="fc" id="L128"> }</span>
/**
* Adds a {@code BeanIntrospector}. This object is invoked when the
property descriptors of a class need to be obtained.
@@ -135,18 +135,18 @@ public class PropertyUtilsBean {
* @since 1.9
*/
public void addBeanIntrospector(final BeanIntrospector introspector) {
-<span class="nc" id="L138">
introspectors.add(Objects.requireNonNull(introspector,
"introspector"));</span>
-<span class="nc" id="L139"> }</span>
+<span class="fc" id="L138">
introspectors.add(Objects.requireNonNull(introspector,
"introspector"));</span>
+<span class="fc" id="L139"> }</span>
/**
* Clear any cached property descriptors information for all classes
loaded by any class loaders. This is useful in cases where class loaders are
thrown
* away to implement class reloading.
*/
public void clearDescriptors() {
-<span class="nc" id="L146"> descriptorsCache.clear();</span>
-<span class="nc" id="L147"> mappedDescriptorsCache.clear();</span>
-<span class="nc" id="L148"> Introspector.flushCaches();</span>
-<span class="nc" id="L149"> }</span>
+<span class="fc" id="L146"> descriptorsCache.clear();</span>
+<span class="fc" id="L147"> mappedDescriptorsCache.clear();</span>
+<span class="fc" id="L148"> Introspector.flushCaches();</span>
+<span class="fc" id="L149"> }</span>
/**
* <p>
@@ -176,66 +176,66 @@ public class PropertyUtilsBean {
// TODO BEFORE 2.0
// MISMATCH between implementation and Javadoc.
NoSuchMethodException {
-<span class="nc" id="L179"> Objects.requireNonNull(dest,
"dest");</span>
-<span class="nc" id="L180"> Objects.requireNonNull(orig,
"orig");</span>
-<span class="nc bnc" id="L181" title="All 2 branches missed."> if (orig
instanceof DynaBean) {</span>
-<span class="nc" id="L182"> final DynaProperty[] origDescriptors =
((DynaBean) orig).getDynaClass().getDynaProperties();</span>
-<span class="nc bnc" id="L183" title="All 2 branches missed."> for
(final DynaProperty origDescriptor : origDescriptors) {</span>
-<span class="nc" id="L184"> final String name =
origDescriptor.getName();</span>
-<span class="nc bnc" id="L185" title="All 4 branches missed.">
if (isReadable(orig, name) && isWriteable(dest, name)) {</span>
+<span class="fc" id="L179"> Objects.requireNonNull(dest,
"dest");</span>
+<span class="fc" id="L180"> Objects.requireNonNull(orig,
"orig");</span>
+<span class="fc bfc" id="L181" title="All 2 branches covered."> if
(orig instanceof DynaBean) {</span>
+<span class="fc" id="L182"> final DynaProperty[] origDescriptors =
((DynaBean) orig).getDynaClass().getDynaProperties();</span>
+<span class="fc bfc" id="L183" title="All 2 branches covered."> for
(final DynaProperty origDescriptor : origDescriptors) {</span>
+<span class="fc" id="L184"> final String name =
origDescriptor.getName();</span>
+<span class="fc bfc" id="L185" title="All 4 branches covered.">
if (isReadable(orig, name) && isWriteable(dest, name)) {</span>
try {
-<span class="nc" id="L187"> final Object value =
((DynaBean) orig).get(name);</span>
-<span class="nc bnc" id="L188" title="All 2 branches missed.">
if (dest instanceof DynaBean) {</span>
-<span class="nc" id="L189"> ((DynaBean)
dest).set(name, value);</span>
-<span class="nc" id="L190"> } else {</span>
+<span class="fc" id="L187"> final Object value =
((DynaBean) orig).get(name);</span>
+<span class="pc bpc" id="L188" title="1 of 2 branches missed.">
if (dest instanceof DynaBean) {</span>
+<span class="fc" id="L189"> ((DynaBean)
dest).set(name, value);</span>
+ } else {
<span class="nc" id="L191"> setSimpleProperty(dest,
name, value);</span>
}
<span class="nc" id="L193"> } catch (final
NoSuchMethodException e) {</span>
<span class="nc bnc" id="L194" title="All 2 branches missed.">
if (LOG.isDebugEnabled()) {</span>
<span class="nc" id="L195"> LOG.debug("Error
writing to '" + name + "' on class '" + dest.getClass() +
"'", e);</span>
}
- }
+<span class="fc" id="L197"> }</span>
}
}
-<span class="nc bnc" id="L200" title="All 2 branches missed."> } else
if (orig instanceof Map) {</span>
-<span class="nc bnc" id="L201" title="All 2 branches missed."> for
(final Map.Entry<?, ?> entry : ((Map<?, ?>) orig).entrySet())
{</span>
-<span class="nc" id="L202"> final String name = (String)
entry.getKey();</span>
-<span class="nc bnc" id="L203" title="All 2 branches missed.">
if (isWriteable(dest, name)) {</span>
+<span class="fc bfc" id="L200" title="All 2 branches covered."> } else
if (orig instanceof Map) {</span>
+<span class="fc bfc" id="L201" title="All 2 branches covered."> for
(final Map.Entry<?, ?> entry : ((Map<?, ?>) orig).entrySet())
{</span>
+<span class="fc" id="L202"> final String name = (String)
entry.getKey();</span>
+<span class="fc bfc" id="L203" title="All 2 branches covered.">
if (isWriteable(dest, name)) {</span>
try {
-<span class="nc bnc" id="L205" title="All 2 branches missed.">
if (dest instanceof DynaBean) {</span>
-<span class="nc" id="L206"> ((DynaBean)
dest).set(name, entry.getValue());</span>
-<span class="nc" id="L207"> } else {</span>
-<span class="nc" id="L208"> setSimpleProperty(dest,
name, entry.getValue());</span>
+<span class="fc bfc" id="L205" title="All 2 branches covered.">
if (dest instanceof DynaBean) {</span>
+<span class="fc" id="L206"> ((DynaBean)
dest).set(name, entry.getValue());</span>
+ } else {
+<span class="fc" id="L208"> setSimpleProperty(dest,
name, entry.getValue());</span>
}
<span class="nc" id="L210"> } catch (final
NoSuchMethodException e) {</span>
<span class="nc bnc" id="L211" title="All 2 branches missed.">
if (LOG.isDebugEnabled()) {</span>
<span class="nc" id="L212"> LOG.debug("Error
writing to '" + name + "' on class '" + dest.getClass() +
"'", e);</span>
}
- }
+<span class="fc" id="L214"> }</span>
}
- }
-<span class="nc" id="L217"> } else /* if (orig is a standard JavaBean)
*/ {</span>
-<span class="nc" id="L218"> final PropertyDescriptor[]
origDescriptors = getPropertyDescriptors(orig);</span>
-<span class="nc bnc" id="L219" title="All 2 branches missed."> for
(final PropertyDescriptor origDescriptor : origDescriptors) {</span>
-<span class="nc" id="L220"> final String name =
origDescriptor.getName();</span>
-<span class="nc bnc" id="L221" title="All 4 branches missed.">
if (isReadable(orig, name) && isWriteable(dest, name)) {</span>
+<span class="fc" id="L216"> }</span>
+ } else /* if (orig is a standard JavaBean) */ {
+<span class="fc" id="L218"> final PropertyDescriptor[]
origDescriptors = getPropertyDescriptors(orig);</span>
+<span class="fc bfc" id="L219" title="All 2 branches covered."> for
(final PropertyDescriptor origDescriptor : origDescriptors) {</span>
+<span class="fc" id="L220"> final String name =
origDescriptor.getName();</span>
+<span class="fc bfc" id="L221" title="All 4 branches covered.">
if (isReadable(orig, name) && isWriteable(dest, name)) {</span>
try {
<span class="nc" id="L223"> final Object value =
getSimpleProperty(orig, name);</span>
<span class="nc bnc" id="L224" title="All 2 branches missed.">
if (dest instanceof DynaBean) {</span>
<span class="nc" id="L225"> ((DynaBean)
dest).set(name, value);</span>
-<span class="nc" id="L226"> } else {</span>
+ } else {
<span class="nc" id="L227"> setSimpleProperty(dest,
name, value);</span>
}
-<span class="nc" id="L229"> } catch (final
NoSuchMethodException e) {</span>
-<span class="nc bnc" id="L230" title="All 2 branches missed.">
if (LOG.isDebugEnabled()) {</span>
+<span class="fc" id="L229"> } catch (final
NoSuchMethodException e) {</span>
+<span class="pc bpc" id="L230" title="1 of 2 branches missed.">
if (LOG.isDebugEnabled()) {</span>
<span class="nc" id="L231"> LOG.debug("Error
writing to '" + name + "' on class '" + dest.getClass() +
"'", e);</span>
}
- }
+<span class="nc" id="L233"> }</span>
}
}
}
-<span class="nc" id="L238"> }</span>
+<span class="fc" id="L238"> }</span>
/**
* <p>
@@ -255,24 +255,24 @@ public class PropertyUtilsBean {
* @throws NoSuchMethodException if an accessor method for this
property cannot be found
*/
public Map<String, Object> describe(final Object bean) throws
IllegalAccessException, InvocationTargetException, NoSuchMethodException {
-<span class="nc" id="L258"> Objects.requireNonNull(bean,
"bean");</span>
-<span class="nc" id="L259"> final Map<String, Object> description
= new HashMap<>();</span>
-<span class="nc bnc" id="L260" title="All 2 branches missed."> if (bean
instanceof DynaBean) {</span>
-<span class="nc" id="L261"> final DynaProperty[] descriptors =
((DynaBean) bean).getDynaClass().getDynaProperties();</span>
-<span class="nc bnc" id="L262" title="All 2 branches missed."> for
(final DynaProperty descriptor : descriptors) {</span>
-<span class="nc" id="L263"> final String name =
descriptor.getName();</span>
-<span class="nc" id="L264"> description.put(name,
getProperty(bean, name));</span>
- }
-<span class="nc" id="L266"> } else {</span>
-<span class="nc" id="L267"> final PropertyDescriptor[] descriptors
= getPropertyDescriptors(bean);</span>
-<span class="nc bnc" id="L268" title="All 2 branches missed."> for
(final PropertyDescriptor descriptor : descriptors) {</span>
-<span class="nc" id="L269"> final String name =
descriptor.getName();</span>
-<span class="nc bnc" id="L270" title="All 2 branches missed.">
if (descriptor.getReadMethod() != null) {</span>
-<span class="nc" id="L271"> description.put(name,
getProperty(bean, name));</span>
+<span class="fc" id="L258"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L259"> final Map<String, Object> description
= new HashMap<>();</span>
+<span class="fc bfc" id="L260" title="All 2 branches covered."> if
(bean instanceof DynaBean) {</span>
+<span class="fc" id="L261"> final DynaProperty[] descriptors =
((DynaBean) bean).getDynaClass().getDynaProperties();</span>
+<span class="fc bfc" id="L262" title="All 2 branches covered."> for
(final DynaProperty descriptor : descriptors) {</span>
+<span class="fc" id="L263"> final String name =
descriptor.getName();</span>
+<span class="fc" id="L264"> description.put(name,
getProperty(bean, name));</span>
+ }
+<span class="fc" id="L266"> } else {</span>
+<span class="fc" id="L267"> final PropertyDescriptor[] descriptors
= getPropertyDescriptors(bean);</span>
+<span class="fc bfc" id="L268" title="All 2 branches covered."> for
(final PropertyDescriptor descriptor : descriptors) {</span>
+<span class="fc" id="L269"> final String name =
descriptor.getName();</span>
+<span class="fc bfc" id="L270" title="All 2 branches covered.">
if (descriptor.getReadMethod() != null) {</span>
+<span class="fc" id="L271"> description.put(name,
getProperty(bean, name));</span>
}
}
}
-<span class="nc" id="L275"> return description;</span>
+<span class="fc" id="L275"> return description;</span>
}
/**
@@ -282,17 +282,17 @@ public class PropertyUtilsBean {
* @return a data object with the results of introspection
*/
private BeanIntrospectionData fetchIntrospectionData(final Class<?>
beanClass) {
-<span class="nc" id="L285"> final DefaultIntrospectionContext ictx =
new DefaultIntrospectionContext(beanClass);</span>
+<span class="fc" id="L285"> final DefaultIntrospectionContext ictx =
new DefaultIntrospectionContext(beanClass);</span>
-<span class="nc bnc" id="L287" title="All 2 branches missed."> for
(final BeanIntrospector bi : introspectors) {</span>
+<span class="fc bfc" id="L287" title="All 2 branches covered."> for
(final BeanIntrospector bi : introspectors) {</span>
try {
-<span class="nc" id="L289"> bi.introspect(ictx);</span>
-<span class="nc" id="L290"> } catch (final IntrospectionException
iex) {</span>
-<span class="nc" id="L291"> LOG.error("Exception during
introspection", iex);</span>
- }
- }
+<span class="fc" id="L289"> bi.introspect(ictx);</span>
+<span class="fc" id="L290"> } catch (final IntrospectionException
iex) {</span>
+<span class="fc" id="L291"> LOG.error("Exception during
introspection", iex);</span>
+<span class="fc" id="L292"> }</span>
+<span class="fc" id="L293"> }</span>
-<span class="nc" id="L295"> return new
BeanIntrospectionData(ictx.getPropertyDescriptors());</span>
+<span class="fc" id="L295"> return new
BeanIntrospectionData(ictx.getPropertyDescriptors());</span>
}
/**
@@ -310,24 +310,24 @@ public class PropertyUtilsBean {
* @throws NoSuchMethodException if an accessor method for this
property cannot be found
*/
public Object getIndexedProperty(final Object bean, String name) throws
IllegalAccessException, InvocationTargetException, NoSuchMethodException {
-<span class="nc" id="L313"> Objects.requireNonNull(bean,
"bean");</span>
-<span class="nc" id="L314"> Objects.requireNonNull(name,
"name");</span>
+<span class="fc" id="L313"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L314"> Objects.requireNonNull(name,
"name");</span>
// Identify the index of the requested individual property
-<span class="nc" id="L316"> int index = -1;</span>
+<span class="fc" id="L316"> int index = -1;</span>
try {
-<span class="nc" id="L318"> index = resolver.getIndex(name);</span>
+<span class="fc" id="L318"> index = resolver.getIndex(name);</span>
<span class="nc" id="L319"> } catch (final IllegalArgumentException e)
{</span>
<span class="nc" id="L320"> throw new
IllegalArgumentException("Invalid indexed property '" + name +
"' on bean class '" + bean.getClass() + "' " +
e.getMessage());</span>
- }
-<span class="nc bnc" id="L322" title="All 2 branches missed."> if
(index < 0) {</span>
-<span class="nc" id="L323"> throw new
IllegalArgumentException("Invalid indexed property '" + name +
"' on bean class '" + bean.getClass() + "'");</span>
+<span class="fc" id="L321"> }</span>
+<span class="fc bfc" id="L322" title="All 2 branches covered."> if
(index < 0) {</span>
+<span class="fc" id="L323"> throw new
IllegalArgumentException("Invalid indexed property '" + name +
"' on bean class '" + bean.getClass() + "'");</span>
}
// Isolate the name
-<span class="nc" id="L327"> name = resolver.getProperty(name);</span>
+<span class="fc" id="L327"> name = resolver.getProperty(name);</span>
// Request the specified indexed property value
-<span class="nc" id="L330"> return getIndexedProperty(bean, name,
index);</span>
+<span class="fc" id="L330"> return getIndexedProperty(bean, name,
index);</span>
}
/**
@@ -346,41 +346,41 @@ public class PropertyUtilsBean {
*/
public Object getIndexedProperty(final Object bean, final String name,
final int index)
throws IllegalAccessException, InvocationTargetException,
NoSuchMethodException {
-<span class="nc" id="L349"> Objects.requireNonNull(bean,
"bean");</span>
-<span class="nc bnc" id="L350" title="All 4 branches missed."> if (name
== null || name.isEmpty()) {</span>
-<span class="nc bnc" id="L351" title="All 2 branches missed."> if
(bean.getClass().isArray()) {</span>
-<span class="nc" id="L352"> return Array.get(bean,
index);</span>
+<span class="fc" id="L349"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc bfc" id="L350" title="All 4 branches covered."> if
(name == null || name.isEmpty()) {</span>
+<span class="fc bfc" id="L351" title="All 2 branches covered."> if
(bean.getClass().isArray()) {</span>
+<span class="fc" id="L352"> return Array.get(bean,
index);</span>
}
-<span class="nc bnc" id="L354" title="All 2 branches missed."> if
(bean instanceof List) {</span>
-<span class="nc" id="L355"> return ((List<?>)
bean).get(index);</span>
+<span class="fc bfc" id="L354" title="All 2 branches covered."> if
(bean instanceof List) {</span>
+<span class="fc" id="L355"> return ((List<?>)
bean).get(index);</span>
}
}
-<span class="nc" id="L358"> Objects.requireNonNull(name,
"name");</span>
+<span class="fc" id="L358"> Objects.requireNonNull(name,
"name");</span>
// Handle DynaBean instances specially
-<span class="nc bnc" id="L360" title="All 2 branches missed."> if (bean
instanceof DynaBean) {</span>
-<span class="nc" id="L361"> final DynaProperty descriptor =
((DynaBean) bean).getDynaClass().getDynaProperty(name);</span>
-<span class="nc bnc" id="L362" title="All 2 branches missed."> if
(descriptor == null) {</span>
-<span class="nc" id="L363"> throw new
NoSuchMethodException("Unknown property '" + name + "' on bean
class '" + bean.getClass() + "'");</span>
+<span class="fc bfc" id="L360" title="All 2 branches covered."> if
(bean instanceof DynaBean) {</span>
+<span class="fc" id="L361"> final DynaProperty descriptor =
((DynaBean) bean).getDynaClass().getDynaProperty(name);</span>
+<span class="fc bfc" id="L362" title="All 2 branches covered."> if
(descriptor == null) {</span>
+<span class="fc" id="L363"> throw new
NoSuchMethodException("Unknown property '" + name + "' on bean
class '" + bean.getClass() + "'");</span>
}
-<span class="nc" id="L365"> return ((DynaBean) bean).get(name,
index);</span>
+<span class="fc" id="L365"> return ((DynaBean) bean).get(name,
index);</span>
}
// Retrieve the property descriptor for the specified property
-<span class="nc" id="L369"> final PropertyDescriptor descriptor =
getPropertyDescriptor(bean, name);</span>
-<span class="nc bnc" id="L370" title="All 2 branches missed."> if
(descriptor == null) {</span>
-<span class="nc" id="L371"> throw new
NoSuchMethodException("Unknown property '" + name + "' on bean
class '" + bean.getClass() + "'");</span>
+<span class="fc" id="L369"> final PropertyDescriptor descriptor =
getPropertyDescriptor(bean, name);</span>
+<span class="fc bfc" id="L370" title="All 2 branches covered."> if
(descriptor == null) {</span>
+<span class="fc" id="L371"> throw new
NoSuchMethodException("Unknown property '" + name + "' on bean
class '" + bean.getClass() + "'");</span>
}
// Call the indexed getter method if there is one
-<span class="nc bnc" id="L375" title="All 2 branches missed."> if
(descriptor instanceof IndexedPropertyDescriptor) {</span>
-<span class="nc" id="L376"> Method readMethod =
((IndexedPropertyDescriptor) descriptor).getIndexedReadMethod();</span>
-<span class="nc" id="L377"> readMethod =
MethodUtils.getAccessibleMethod(bean.getClass(), readMethod);</span>
-<span class="nc bnc" id="L378" title="All 2 branches missed."> if
(readMethod != null) {</span>
+<span class="fc bfc" id="L375" title="All 2 branches covered."> if
(descriptor instanceof IndexedPropertyDescriptor) {</span>
+<span class="fc" id="L376"> Method readMethod =
((IndexedPropertyDescriptor) descriptor).getIndexedReadMethod();</span>
+<span class="fc" id="L377"> readMethod =
MethodUtils.getAccessibleMethod(bean.getClass(), readMethod);</span>
+<span class="fc bfc" id="L378" title="All 2 branches covered."> if
(readMethod != null) {</span>
try {
-<span class="nc" id="L380"> return invokeMethod(readMethod,
bean, Integer.valueOf(index));</span>
-<span class="nc" id="L381"> } catch (final
InvocationTargetException e) {</span>
-<span class="nc bnc" id="L382" title="All 2 branches missed.">
if (e.getTargetException() instanceof IndexOutOfBoundsException) {</span>
-<span class="nc" id="L383"> throw
(IndexOutOfBoundsException) e.getTargetException();</span>
+<span class="fc" id="L380"> return invokeMethod(readMethod,
bean, Integer.valueOf(index));</span>
+<span class="fc" id="L381"> } catch (final
InvocationTargetException e) {</span>
+<span class="pc bpc" id="L382" title="1 of 2 branches missed.">
if (e.getTargetException() instanceof IndexOutOfBoundsException) {</span>
+<span class="fc" id="L383"> throw
(IndexOutOfBoundsException) e.getTargetException();</span>
}
<span class="nc" id="L385"> throw e;</span>
}
@@ -388,25 +388,25 @@ public class PropertyUtilsBean {
}
// Otherwise, the underlying property must be an array
-<span class="nc" id="L391"> final Method readMethod =
getReadMethod(bean.getClass(), descriptor);</span>
-<span class="nc bnc" id="L392" title="All 2 branches missed."> if
(readMethod == null) {</span>
-<span class="nc" id="L393"> throw new
NoSuchMethodException("Property '" + name + "' has no " +
"getter method on bean class '" + bean.getClass() +
"'");</span>
+<span class="fc" id="L391"> final Method readMethod =
getReadMethod(bean.getClass(), descriptor);</span>
+<span class="fc bfc" id="L392" title="All 2 branches covered."> if
(readMethod == null) {</span>
+<span class="fc" id="L393"> throw new
NoSuchMethodException("Property '" + name + "' has no " +
"getter method on bean class '" + bean.getClass() +
"'");</span>
}
// Call the property getter and return the value
-<span class="nc" id="L397"> final Object value =
invokeMethod(readMethod, bean, BeanUtils.EMPTY_OBJECT_ARRAY);</span>
-<span class="nc bnc" id="L398" title="All 2 branches missed."> if
(!value.getClass().isArray()) {</span>
-<span class="nc bnc" id="L399" title="All 2 branches missed."> if
(!(value instanceof List)) {</span>
+<span class="fc" id="L397"> final Object value =
invokeMethod(readMethod, bean, BeanUtils.EMPTY_OBJECT_ARRAY);</span>
+<span class="fc bfc" id="L398" title="All 2 branches covered."> if
(!value.getClass().isArray()) {</span>
+<span class="pc bpc" id="L399" title="1 of 2 branches missed."> if
(!(value instanceof List)) {</span>
<span class="nc" id="L400"> throw new
IllegalArgumentException("Property '" + name + "' is not indexed
on bean class '" + bean.getClass() + "'");</span>
}
// get the List's value
-<span class="nc" id="L403"> return ((List<?>)
value).get(index);</span>
+<span class="fc" id="L403"> return ((List<?>)
value).get(index);</span>
}
// get the array's value
try {
-<span class="nc" id="L407"> return Array.get(value, index);</span>
-<span class="nc" id="L408"> } catch (final
ArrayIndexOutOfBoundsException e) {</span>
-<span class="nc" id="L409"> throw new
ArrayIndexOutOfBoundsException("Index: " + index + ", Size:
" + Array.getLength(value) + " for property '" + name +
"'");</span>
+<span class="fc" id="L407"> return Array.get(value, index);</span>
+<span class="fc" id="L408"> } catch (final
ArrayIndexOutOfBoundsException e) {</span>
+<span class="fc" id="L409"> throw new
ArrayIndexOutOfBoundsException("Index: " + index + ", Size:
" + Array.getLength(value) + " for property '" + name +
"'");</span>
}
}
@@ -419,14 +419,14 @@ public class PropertyUtilsBean {
* @throws IllegalArgumentException if the bean class is
<strong>null</strong>
*/
private BeanIntrospectionData getIntrospectionData(final Class<?>
beanClass) {
-<span class="nc" id="L422"> Objects.requireNonNull(beanClass,
"beanClass");</span>
+<span class="fc" id="L422"> Objects.requireNonNull(beanClass,
"beanClass");</span>
// Look up any cached information for this bean class
-<span class="nc" id="L424"> BeanIntrospectionData data =
descriptorsCache.get(beanClass);</span>
-<span class="nc bnc" id="L425" title="All 2 branches missed."> if (data
== null) {</span>
-<span class="nc" id="L426"> data =
fetchIntrospectionData(beanClass);</span>
-<span class="nc" id="L427"> descriptorsCache.put(beanClass,
data);</span>
+<span class="fc" id="L424"> BeanIntrospectionData data =
descriptorsCache.get(beanClass);</span>
+<span class="fc bfc" id="L425" title="All 2 branches covered."> if
(data == null) {</span>
+<span class="fc" id="L426"> data =
fetchIntrospectionData(beanClass);</span>
+<span class="fc" id="L427"> descriptorsCache.put(beanClass,
data);</span>
}
-<span class="nc" id="L429"> return data;</span>
+<span class="fc" id="L429"> return data;</span>
}
/**
@@ -441,24 +441,24 @@ public class PropertyUtilsBean {
* @throws NoSuchMethodException if an accessor method for this
property cannot be found
*/
public Object getMappedProperty(final Object bean, String name) throws
IllegalAccessException, InvocationTargetException, NoSuchMethodException {
-<span class="nc" id="L444"> Objects.requireNonNull(bean,
"bean");</span>
-<span class="nc" id="L445"> Objects.requireNonNull(name,
"name");</span>
+<span class="fc" id="L444"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L445"> Objects.requireNonNull(name,
"name");</span>
// Identify the key of the requested individual property
-<span class="nc" id="L447"> String key = null;</span>
+<span class="fc" id="L447"> String key = null;</span>
try {
-<span class="nc" id="L449"> key = resolver.getKey(name);</span>
+<span class="fc" id="L449"> key = resolver.getKey(name);</span>
<span class="nc" id="L450"> } catch (final IllegalArgumentException e)
{</span>
<span class="nc" id="L451"> throw new
IllegalArgumentException("Invalid mapped property '" + name + "'
on bean class '" + bean.getClass() + "' " +
e.getMessage());</span>
- }
-<span class="nc bnc" id="L453" title="All 2 branches missed."> if (key
== null) {</span>
-<span class="nc" id="L454"> throw new
IllegalArgumentException("Invalid mapped property '" + name + "'
on bean class '" + bean.getClass() + "'");</span>
+<span class="fc" id="L452"> }</span>
+<span class="fc bfc" id="L453" title="All 2 branches covered."> if (key
== null) {</span>
+<span class="fc" id="L454"> throw new
IllegalArgumentException("Invalid mapped property '" + name + "'
on bean class '" + bean.getClass() + "'");</span>
}
// Isolate the name
-<span class="nc" id="L458"> name = resolver.getProperty(name);</span>
+<span class="fc" id="L458"> name = resolver.getProperty(name);</span>
// Request the specified indexed property value
-<span class="nc" id="L461"> return getMappedProperty(bean, name,
key);</span>
+<span class="fc" id="L461"> return getMappedProperty(bean, name,
key);</span>
}
/**
@@ -474,47 +474,47 @@ public class PropertyUtilsBean {
*/
public Object getMappedProperty(final Object bean, final String name,
final String key)
throws IllegalAccessException, InvocationTargetException,
NoSuchMethodException {
-<span class="nc" id="L477"> Objects.requireNonNull(bean,
"bean");</span>
-<span class="nc" id="L478"> Objects.requireNonNull(name,
"name");</span>
-<span class="nc" id="L479"> Objects.requireNonNull(key,
"key");</span>
+<span class="fc" id="L477"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L478"> Objects.requireNonNull(name,
"name");</span>
+<span class="fc" id="L479"> Objects.requireNonNull(key,
"key");</span>
// Handle DynaBean instances specially
-<span class="nc bnc" id="L481" title="All 2 branches missed."> if (bean
instanceof DynaBean) {</span>
-<span class="nc" id="L482"> final DynaProperty descriptor =
((DynaBean) bean).getDynaClass().getDynaProperty(name);</span>
-<span class="nc bnc" id="L483" title="All 2 branches missed."> if
(descriptor == null) {</span>
-<span class="nc" id="L484"> throw new
NoSuchMethodException("Unknown property '" + name + "'+ on bean
class '" + bean.getClass() + "'");</span>
+<span class="fc bfc" id="L481" title="All 2 branches covered."> if
(bean instanceof DynaBean) {</span>
+<span class="fc" id="L482"> final DynaProperty descriptor =
((DynaBean) bean).getDynaClass().getDynaProperty(name);</span>
+<span class="fc bfc" id="L483" title="All 2 branches covered."> if
(descriptor == null) {</span>
+<span class="fc" id="L484"> throw new
NoSuchMethodException("Unknown property '" + name + "'+ on bean
class '" + bean.getClass() + "'");</span>
}
-<span class="nc" id="L486"> return ((DynaBean) bean).get(name,
key);</span>
+<span class="fc" id="L486"> return ((DynaBean) bean).get(name,
key);</span>
}
-<span class="nc" id="L489"> Object result = null;</span>
+<span class="fc" id="L489"> Object result = null;</span>
// Retrieve the property descriptor for the specified property
-<span class="nc" id="L492"> final PropertyDescriptor descriptor =
getPropertyDescriptor(bean, name);</span>
-<span class="nc bnc" id="L493" title="All 2 branches missed."> if
(descriptor == null) {</span>
-<span class="nc" id="L494"> throw new
NoSuchMethodException("Unknown property '" + name + "'+ on bean
class '" + bean.getClass() + "'");</span>
+<span class="fc" id="L492"> final PropertyDescriptor descriptor =
getPropertyDescriptor(bean, name);</span>
+<span class="fc bfc" id="L493" title="All 2 branches covered."> if
(descriptor == null) {</span>
+<span class="fc" id="L494"> throw new
NoSuchMethodException("Unknown property '" + name + "'+ on bean
class '" + bean.getClass() + "'");</span>
}
-<span class="nc bnc" id="L497" title="All 2 branches missed."> if
(descriptor instanceof MappedPropertyDescriptor) {</span>
+<span class="fc bfc" id="L497" title="All 2 branches covered."> if
(descriptor instanceof MappedPropertyDescriptor) {</span>
// Call the keyed getter method if there is one
-<span class="nc" id="L499"> Method readMethod =
((MappedPropertyDescriptor) descriptor).getMappedReadMethod();</span>
-<span class="nc" id="L500"> readMethod =
MethodUtils.getAccessibleMethod(bean.getClass(), readMethod);</span>
-<span class="nc bnc" id="L501" title="All 2 branches missed."> if
(readMethod == null) {</span>
-<span class="nc" id="L502"> throw new
NoSuchMethodException("Property '" + name + "' has no mapped
getter method on bean class '" + bean.getClass() + "'");</span>
+<span class="fc" id="L499"> Method readMethod =
((MappedPropertyDescriptor) descriptor).getMappedReadMethod();</span>
+<span class="fc" id="L500"> readMethod =
MethodUtils.getAccessibleMethod(bean.getClass(), readMethod);</span>
+<span class="fc bfc" id="L501" title="All 2 branches covered."> if
(readMethod == null) {</span>
+<span class="fc" id="L502"> throw new
NoSuchMethodException("Property '" + name + "' has no mapped
getter method on bean class '" + bean.getClass() + "'");</span>
}
-<span class="nc" id="L504"> result = invokeMethod(readMethod, bean,
key);</span>
-<span class="nc" id="L505"> } else {</span>
+<span class="fc" id="L504"> result = invokeMethod(readMethod, bean,
key);</span>
+<span class="fc" id="L505"> } else {</span>
/* means that the result has to be retrieved from a map */
-<span class="nc" id="L507"> final Method readMethod =
getReadMethod(bean.getClass(), descriptor);</span>
-<span class="nc bnc" id="L508" title="All 2 branches missed."> if
(readMethod == null) {</span>
+<span class="fc" id="L507"> final Method readMethod =
getReadMethod(bean.getClass(), descriptor);</span>
+<span class="pc bpc" id="L508" title="1 of 2 branches missed."> if
(readMethod == null) {</span>
<span class="nc" id="L509"> throw new
NoSuchMethodException("Property '" + name + "' has no mapped
getter method on bean class '" + bean.getClass() + "'");</span>
}
-<span class="nc" id="L511"> final Object invokeResult =
invokeMethod(readMethod, bean, BeanUtils.EMPTY_OBJECT_ARRAY);</span>
+<span class="fc" id="L511"> final Object invokeResult =
invokeMethod(readMethod, bean, BeanUtils.EMPTY_OBJECT_ARRAY);</span>
/* test and fetch from the map */
-<span class="nc bnc" id="L513" title="All 2 branches missed."> if
(invokeResult instanceof Map) {</span>
-<span class="nc" id="L514"> result = ((Map<?, ?>)
invokeResult).get(key);</span>
+<span class="pc bpc" id="L513" title="1 of 2 branches missed."> if
(invokeResult instanceof Map) {</span>
+<span class="fc" id="L514"> result = ((Map<?, ?>)
invokeResult).get(key);</span>
}
}
-<span class="nc" id="L517"> return result;</span>
+<span class="fc" id="L517"> return result;</span>
}
/**
@@ -530,11 +530,11 @@ public class PropertyUtilsBean {
* @return the mapped property descriptors
*/
Map<Class<?>, Map> getMappedPropertyDescriptors(final
Class<?> beanClass) {
-<span class="nc bnc" id="L533" title="All 2 branches missed."> if
(beanClass == null) {</span>
-<span class="nc" id="L534"> return null;</span>
+<span class="fc bfc" id="L533" title="All 2 branches covered."> if
(beanClass == null) {</span>
+<span class="fc" id="L534"> return null;</span>
}
// Look up any cached descriptors for this bean class
-<span class="nc" id="L537"> return
mappedDescriptorsCache.get(beanClass);</span>
+<span class="fc" id="L537"> return
mappedDescriptorsCache.get(beanClass);</span>
}
/**
@@ -550,10 +550,10 @@ public class PropertyUtilsBean {
* @return the mapped property descriptors
*/
Map getMappedPropertyDescriptors(final Object bean) {
-<span class="nc bnc" id="L553" title="All 2 branches missed."> if (bean
== null) {</span>
-<span class="nc" id="L554"> return null;</span>
+<span class="fc bfc" id="L553" title="All 2 branches covered."> if
(bean == null) {</span>
+<span class="fc" id="L554"> return null;</span>
}
-<span class="nc" id="L556"> return
getMappedPropertyDescriptors(bean.getClass());</span>
+<span class="fc" id="L556"> return
getMappedPropertyDescriptors(bean.getClass());</span>
}
/**
@@ -569,38 +569,38 @@ public class PropertyUtilsBean {
* @throws NoSuchMethodException if an accessor method for this
property cannot be found
*/
public Object getNestedProperty(Object bean, String name) throws
IllegalAccessException, InvocationTargetException, NoSuchMethodException {
-<span class="nc" id="L572"> Objects.requireNonNull(bean,
"bean");</span>
-<span class="nc" id="L573"> Objects.requireNonNull(name,
"name");</span>
+<span class="fc" id="L572"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L573"> Objects.requireNonNull(name,
"name");</span>
// Resolve nested references
-<span class="nc bnc" id="L575" title="All 2 branches missed."> while
(resolver.hasNested(name)) {</span>
-<span class="nc" id="L576"> final String next =
resolver.next(name);</span>
-<span class="nc" id="L577"> Object nestedBean = null;</span>
-<span class="nc bnc" id="L578" title="All 2 branches missed."> if
(bean instanceof Map) {</span>
-<span class="nc" id="L579"> nestedBean =
getPropertyOfMapBean((Map<?, ?>) bean, next);</span>
-<span class="nc bnc" id="L580" title="All 2 branches missed."> }
else if (resolver.isMapped(next)) {</span>
-<span class="nc" id="L581"> nestedBean =
getMappedProperty(bean, next);</span>
-<span class="nc bnc" id="L582" title="All 2 branches missed."> }
else if (resolver.isIndexed(next)) {</span>
-<span class="nc" id="L583"> nestedBean =
getIndexedProperty(bean, next);</span>
-<span class="nc" id="L584"> } else {</span>
-<span class="nc" id="L585"> nestedBean =
getSimpleProperty(bean, next);</span>
- }
-<span class="nc bnc" id="L587" title="All 2 branches missed."> if
(nestedBean == null) {</span>
-<span class="nc" id="L588"> throw new
NestedNullException("Null property value for '" + name + "' on
bean class '" + bean.getClass() + "'");</span>
- }
-<span class="nc" id="L590"> bean = nestedBean;</span>
-<span class="nc" id="L591"> name = resolver.remove(name);</span>
- }
-
-<span class="nc bnc" id="L594" title="All 2 branches missed."> if (bean
instanceof Map) {</span>
-<span class="nc" id="L595"> bean = getPropertyOfMapBean((Map<?,
?>) bean, name);</span>
-<span class="nc bnc" id="L596" title="All 2 branches missed."> } else
if (resolver.isMapped(name)) {</span>
-<span class="nc" id="L597"> bean = getMappedProperty(bean,
name);</span>
-<span class="nc bnc" id="L598" title="All 2 branches missed."> } else
if (resolver.isIndexed(name)) {</span>
-<span class="nc" id="L599"> bean = getIndexedProperty(bean,
name);</span>
-<span class="nc" id="L600"> } else {</span>
-<span class="nc" id="L601"> bean = getSimpleProperty(bean,
name);</span>
+<span class="fc bfc" id="L575" title="All 2 branches covered."> while
(resolver.hasNested(name)) {</span>
+<span class="fc" id="L576"> final String next =
resolver.next(name);</span>
+<span class="fc" id="L577"> Object nestedBean = null;</span>
+<span class="fc bfc" id="L578" title="All 2 branches covered."> if
(bean instanceof Map) {</span>
+<span class="fc" id="L579"> nestedBean =
getPropertyOfMapBean((Map<?, ?>) bean, next);</span>
+<span class="fc bfc" id="L580" title="All 2 branches covered."> }
else if (resolver.isMapped(next)) {</span>
+<span class="fc" id="L581"> nestedBean =
getMappedProperty(bean, next);</span>
+<span class="fc bfc" id="L582" title="All 2 branches covered."> }
else if (resolver.isIndexed(next)) {</span>
+<span class="fc" id="L583"> nestedBean =
getIndexedProperty(bean, next);</span>
+ } else {
+<span class="fc" id="L585"> nestedBean =
getSimpleProperty(bean, next);</span>
+ }
+<span class="fc bfc" id="L587" title="All 2 branches covered."> if
(nestedBean == null) {</span>
+<span class="fc" id="L588"> throw new
NestedNullException("Null property value for '" + name + "' on
bean class '" + bean.getClass() + "'");</span>
+ }
+<span class="fc" id="L590"> bean = nestedBean;</span>
+<span class="fc" id="L591"> name = resolver.remove(name);</span>
+<span class="fc" id="L592"> }</span>
+
+<span class="fc bfc" id="L594" title="All 2 branches covered."> if
(bean instanceof Map) {</span>
+<span class="fc" id="L595"> bean = getPropertyOfMapBean((Map<?,
?>) bean, name);</span>
+<span class="fc bfc" id="L596" title="All 2 branches covered."> } else
if (resolver.isMapped(name)) {</span>
+<span class="fc" id="L597"> bean = getMappedProperty(bean,
name);</span>
+<span class="fc bfc" id="L598" title="All 2 branches covered."> } else
if (resolver.isIndexed(name)) {</span>
+<span class="fc" id="L599"> bean = getIndexedProperty(bean,
name);</span>
+ } else {
+<span class="fc" id="L601"> bean = getSimpleProperty(bean,
name);</span>
}
-<span class="nc" id="L603"> return bean;</span>
+<span class="fc" id="L603"> return bean;</span>
}
/**
@@ -615,7 +615,7 @@ public class PropertyUtilsBean {
* @throws NoSuchMethodException if an accessor method for this
property cannot be found
*/
public Object getProperty(final Object bean, final String name) throws
IllegalAccessException, InvocationTargetException, NoSuchMethodException {
-<span class="nc" id="L618"> return getNestedProperty(bean, name);</span>
+<span class="fc" id="L618"> return getNestedProperty(bean, name);</span>
}
/**
@@ -643,55 +643,55 @@ public class PropertyUtilsBean {
* @throws NoSuchMethodException if an accessor method for this
property cannot be found
*/
public PropertyDescriptor getPropertyDescriptor(Object bean, String name)
throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
{
-<span class="nc" id="L646"> Objects.requireNonNull(bean,
"bean");</span>
-<span class="nc" id="L647"> Objects.requireNonNull(name,
"name");</span>
+<span class="fc" id="L646"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L647"> Objects.requireNonNull(name,
"name");</span>
// Resolve nested references
-<span class="nc bnc" id="L649" title="All 2 branches missed."> while
(resolver.hasNested(name)) {</span>
-<span class="nc" id="L650"> final String next =
resolver.next(name);</span>
-<span class="nc" id="L651"> final Object nestedBean =
getProperty(bean, next);</span>
-<span class="nc bnc" id="L652" title="All 2 branches missed."> if
(nestedBean == null) {</span>
+<span class="fc bfc" id="L649" title="All 2 branches covered."> while
(resolver.hasNested(name)) {</span>
+<span class="fc" id="L650"> final String next =
resolver.next(name);</span>
+<span class="fc" id="L651"> final Object nestedBean =
getProperty(bean, next);</span>
+<span class="pc bpc" id="L652" title="1 of 2 branches missed."> if
(nestedBean == null) {</span>
<span class="nc" id="L653"> throw new
NestedNullException("Null property value for '" + next + "' on
bean class '" + bean.getClass() + "'");</span>
}
-<span class="nc" id="L655"> bean = nestedBean;</span>
-<span class="nc" id="L656"> name = resolver.remove(name);</span>
- }
+<span class="fc" id="L655"> bean = nestedBean;</span>
+<span class="fc" id="L656"> name = resolver.remove(name);</span>
+<span class="fc" id="L657"> }</span>
// Remove any subscript from the final name value
-<span class="nc" id="L660"> name = resolver.getProperty(name);</span>
+<span class="fc" id="L660"> name = resolver.getProperty(name);</span>
// Look up and return this property from our cache
// creating and adding it to the cache if not found.
-<span class="nc bnc" id="L664" title="All 2 branches missed."> if (name
== null) {</span>
+<span class="pc bpc" id="L664" title="1 of 2 branches missed."> if
(name == null) {</span>
<span class="nc" id="L665"> return null;</span>
}
-<span class="nc" id="L668"> final BeanIntrospectionData data =
getIntrospectionData(bean.getClass());</span>
-<span class="nc" id="L669"> PropertyDescriptor result =
data.getDescriptor(name);</span>
-<span class="nc bnc" id="L670" title="All 2 branches missed."> if
(result != null) {</span>
-<span class="nc" id="L671"> return result;</span>
+<span class="fc" id="L668"> final BeanIntrospectionData data =
getIntrospectionData(bean.getClass());</span>
+<span class="fc" id="L669"> PropertyDescriptor result =
data.getDescriptor(name);</span>
+<span class="fc bfc" id="L670" title="All 2 branches covered."> if
(result != null) {</span>
+<span class="fc" id="L671"> return result;</span>
}
-<span class="nc" id="L674"> Map mappedDescriptors =
getMappedPropertyDescriptors(bean);</span>
-<span class="nc bnc" id="L675" title="All 2 branches missed."> if
(mappedDescriptors == null) {</span>
-<span class="nc" id="L676"> mappedDescriptors = new
ConcurrentHashMap<Class<?>, Map>();</span>
-<span class="nc" id="L677">
mappedDescriptorsCache.put(bean.getClass(), mappedDescriptors);</span>
+<span class="fc" id="L674"> Map mappedDescriptors =
getMappedPropertyDescriptors(bean);</span>
+<span class="fc bfc" id="L675" title="All 2 branches covered."> if
(mappedDescriptors == null) {</span>
+<span class="fc" id="L676"> mappedDescriptors = new
ConcurrentHashMap<Class<?>, Map>();</span>
+<span class="fc" id="L677">
mappedDescriptorsCache.put(bean.getClass(), mappedDescriptors);</span>
}
-<span class="nc" id="L679"> result = (PropertyDescriptor)
mappedDescriptors.get(name);</span>
-<span class="nc bnc" id="L680" title="All 2 branches missed."> if
(result == null) {</span>
+<span class="fc" id="L679"> result = (PropertyDescriptor)
mappedDescriptors.get(name);</span>
+<span class="fc bfc" id="L680" title="All 2 branches covered."> if
(result == null) {</span>
// not found, try to create it
try {
-<span class="nc" id="L683"> result = new
MappedPropertyDescriptor(name, bean.getClass());</span>
-<span class="nc" id="L684"> } catch (final IntrospectionException
ie) {</span>
+<span class="fc" id="L683"> result = new
MappedPropertyDescriptor(name, bean.getClass());</span>
+<span class="fc" id="L684"> } catch (final IntrospectionException
ie) {</span>
/*
* Swallow IntrospectionException TODO: Why?
*/
- }
-<span class="nc bnc" id="L689" title="All 2 branches missed."> if
(result != null) {</span>
-<span class="nc" id="L690"> mappedDescriptors.put(name,
result);</span>
+<span class="fc" id="L688"> }</span>
+<span class="fc bfc" id="L689" title="All 2 branches covered."> if
(result != null) {</span>
+<span class="fc" id="L690"> mappedDescriptors.put(name,
result);</span>
}
}
-<span class="nc" id="L694"> return result;</span>
+<span class="fc" id="L694"> return result;</span>
}
/**
@@ -708,7 +708,7 @@ public class PropertyUtilsBean {
* @throws IllegalArgumentException if {@code beanClass} is null
*/
public PropertyDescriptor[] getPropertyDescriptors(final Class<?>
beanClass) {
-<span class="nc" id="L711"> return
getIntrospectionData(beanClass).getDescriptors();</span>
+<span class="fc" id="L711"> return
getIntrospectionData(beanClass).getDescriptors();</span>
}
/**
@@ -725,8 +725,8 @@ public class PropertyUtilsBean {
* @throws IllegalArgumentException if {@code bean} is null
*/
public PropertyDescriptor[] getPropertyDescriptors(final Object bean) {
-<span class="nc" id="L728"> Objects.requireNonNull(bean,
"bean");</span>
-<span class="nc" id="L729"> return
getPropertyDescriptors(bean.getClass());</span>
+<span class="fc" id="L728"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L729"> return
getPropertyDescriptors(bean.getClass());</span>
}
/**
@@ -756,7 +756,7 @@ public class PropertyUtilsBean {
*/
public Class<?> getPropertyEditorClass(final Object bean, final
String name)
throws IllegalAccessException, InvocationTargetException,
NoSuchMethodException {
-<span class="nc" id="L759"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L759"> Objects.requireNonNull(bean,
"bean");</span>
<span class="nc" id="L760"> Objects.requireNonNull(name,
"name");</span>
<span class="nc" id="L761"> final PropertyDescriptor descriptor =
getPropertyDescriptor(bean, name);</span>
<span class="nc bnc" id="L762" title="All 2 branches missed."> if
(descriptor != null) {</span>
@@ -784,18 +784,18 @@ public class PropertyUtilsBean {
protected Object getPropertyOfMapBean(final Map<?, ?> bean, String
propertyName)
throws IllegalArgumentException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException {
-<span class="nc bnc" id="L787" title="All 2 branches missed."> if
(resolver.isMapped(propertyName)) {</span>
-<span class="nc" id="L788"> final String name =
resolver.getProperty(propertyName);</span>
-<span class="nc bnc" id="L789" title="All 4 branches missed."> if
(name == null || name.isEmpty()) {</span>
-<span class="nc" id="L790"> propertyName =
resolver.getKey(propertyName);</span>
+<span class="fc bfc" id="L787" title="All 2 branches covered."> if
(resolver.isMapped(propertyName)) {</span>
+<span class="fc" id="L788"> final String name =
resolver.getProperty(propertyName);</span>
+<span class="pc bpc" id="L789" title="2 of 4 branches missed."> if
(name == null || name.isEmpty()) {</span>
+<span class="fc" id="L790"> propertyName =
resolver.getKey(propertyName);</span>
}
}
-<span class="nc bnc" id="L794" title="All 4 branches missed."> if
(resolver.isIndexed(propertyName) || resolver.isMapped(propertyName)) {</span>
-<span class="nc" id="L795"> throw new
IllegalArgumentException("Indexed or mapped properties are not supported
on" + " objects of type Map: " + propertyName);</span>
+<span class="pc bpc" id="L794" title="1 of 4 branches missed."> if
(resolver.isIndexed(propertyName) || resolver.isMapped(propertyName)) {</span>
+<span class="fc" id="L795"> throw new
IllegalArgumentException("Indexed or mapped properties are not supported
on" + " objects of type Map: " + propertyName);</span>
}
-<span class="nc" id="L798"> return bean.get(propertyName);</span>
+<span class="fc" id="L798"> return bean.get(propertyName);</span>
}
/**
@@ -818,49 +818,49 @@ public class PropertyUtilsBean {
* @throws NoSuchMethodException if an accessor method for this
property cannot be found
*/
public Class<?> getPropertyType(Object bean, String name) throws
IllegalAccessException, InvocationTargetException, NoSuchMethodException {
-<span class="nc" id="L821"> Objects.requireNonNull(bean,
"bean");</span>
-<span class="nc" id="L822"> Objects.requireNonNull(name,
"name");</span>
+<span class="fc" id="L821"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L822"> Objects.requireNonNull(name,
"name");</span>
// Resolve nested references
-<span class="nc bnc" id="L824" title="All 2 branches missed."> while
(resolver.hasNested(name)) {</span>
-<span class="nc" id="L825"> final String next =
resolver.next(name);</span>
-<span class="nc" id="L826"> final Object nestedBean =
getProperty(bean, next);</span>
-<span class="nc bnc" id="L827" title="All 2 branches missed."> if
(nestedBean == null) {</span>
-<span class="nc" id="L828"> throw new
NestedNullException("Null property value for '" + next + "' on
bean class '" + bean.getClass() + "'");</span>
- }
-<span class="nc" id="L830"> bean = nestedBean;</span>
-<span class="nc" id="L831"> name = resolver.remove(name);</span>
- }
+<span class="fc bfc" id="L824" title="All 2 branches covered."> while
(resolver.hasNested(name)) {</span>
+<span class="fc" id="L825"> final String next =
resolver.next(name);</span>
+<span class="fc" id="L826"> final Object nestedBean =
getProperty(bean, next);</span>
+<span class="fc bfc" id="L827" title="All 2 branches covered."> if
(nestedBean == null) {</span>
+<span class="fc" id="L828"> throw new
NestedNullException("Null property value for '" + next + "' on
bean class '" + bean.getClass() + "'");</span>
+ }
+<span class="fc" id="L830"> bean = nestedBean;</span>
+<span class="fc" id="L831"> name = resolver.remove(name);</span>
+<span class="fc" id="L832"> }</span>
// Remove any subscript from the final name value
-<span class="nc" id="L835"> name = resolver.getProperty(name);</span>
+<span class="fc" id="L835"> name = resolver.getProperty(name);</span>
// Special handling for DynaBeans
-<span class="nc bnc" id="L838" title="All 2 branches missed."> if (bean
instanceof DynaBean) {</span>
-<span class="nc" id="L839"> final DynaProperty descriptor =
((DynaBean) bean).getDynaClass().getDynaProperty(name);</span>
-<span class="nc bnc" id="L840" title="All 2 branches missed."> if
(descriptor == null) {</span>
+<span class="fc bfc" id="L838" title="All 2 branches covered."> if
(bean instanceof DynaBean) {</span>
+<span class="fc" id="L839"> final DynaProperty descriptor =
((DynaBean) bean).getDynaClass().getDynaProperty(name);</span>
+<span class="pc bpc" id="L840" title="1 of 2 branches missed."> if
(descriptor == null) {</span>
<span class="nc" id="L841"> return null;</span>
}
-<span class="nc" id="L843"> final Class<?> type =
descriptor.getType();</span>
-<span class="nc bnc" id="L844" title="All 2 branches missed."> if
(type == null) {</span>
+<span class="fc" id="L843"> final Class<?> type =
descriptor.getType();</span>
+<span class="pc bpc" id="L844" title="1 of 2 branches missed."> if
(type == null) {</span>
<span class="nc" id="L845"> return null;</span>
}
-<span class="nc bnc" id="L847" title="All 2 branches missed."> if
(type.isArray()) {</span>
+<span class="pc bpc" id="L847" title="1 of 2 branches missed."> if
(type.isArray()) {</span>
<span class="nc" id="L848"> return
type.getComponentType();</span>
}
-<span class="nc" id="L850"> return type;</span>
+<span class="fc" id="L850"> return type;</span>
}
-<span class="nc" id="L853"> final PropertyDescriptor descriptor =
getPropertyDescriptor(bean, name);</span>
-<span class="nc bnc" id="L854" title="All 2 branches missed."> if
(descriptor == null) {</span>
+<span class="fc" id="L853"> final PropertyDescriptor descriptor =
getPropertyDescriptor(bean, name);</span>
+<span class="pc bpc" id="L854" title="1 of 2 branches missed."> if
(descriptor == null) {</span>
<span class="nc" id="L855"> return null;</span>
}
-<span class="nc bnc" id="L857" title="All 2 branches missed."> if
(descriptor instanceof IndexedPropertyDescriptor) {</span>
-<span class="nc" id="L858"> return ((IndexedPropertyDescriptor)
descriptor).getIndexedPropertyType();</span>
+<span class="fc bfc" id="L857" title="All 2 branches covered."> if
(descriptor instanceof IndexedPropertyDescriptor) {</span>
+<span class="fc" id="L858"> return ((IndexedPropertyDescriptor)
descriptor).getIndexedPropertyType();</span>
}
-<span class="nc bnc" id="L860" title="All 2 branches missed."> if
(descriptor instanceof MappedPropertyDescriptor) {</span>
-<span class="nc" id="L861"> return ((MappedPropertyDescriptor)
descriptor).getMappedPropertyType();</span>
+<span class="fc bfc" id="L860" title="All 2 branches covered."> if
(descriptor instanceof MappedPropertyDescriptor) {</span>
+<span class="fc" id="L861"> return ((MappedPropertyDescriptor)
descriptor).getMappedPropertyType();</span>
}
-<span class="nc" id="L863"> return descriptor.getPropertyType();</span>
+<span class="fc" id="L863"> return descriptor.getPropertyType();</span>
}
/**
@@ -884,7 +884,7 @@ public class PropertyUtilsBean {
* @since 2.0.0
*/
public Method getReadMethod(final Class<?> clazz, final
PropertyDescriptor descriptor) {
-<span class="nc" id="L887"> return
MethodUtils.getAccessibleMethod(clazz, descriptor.getReadMethod());</span>
+<span class="fc" id="L887"> return
MethodUtils.getAccessibleMethod(clazz, descriptor.getReadMethod());</span>
}
/**
@@ -900,7 +900,7 @@ public class PropertyUtilsBean {
* @return The read method
*/
public Method getReadMethod(final PropertyDescriptor descriptor) {
-<span class="nc" id="L903"> return
MethodUtils.getAccessibleMethod(descriptor.getReadMethod());</span>
+<span class="fc" id="L903"> return
MethodUtils.getAccessibleMethod(descriptor.getReadMethod());</span>
}
/**
@@ -915,7 +915,7 @@ public class PropertyUtilsBean {
* @since 1.8.0
*/
public Resolver getResolver() {
-<span class="nc" id="L918"> return resolver;</span>
+<span class="fc" id="L918"> return resolver;</span>
}
/**
@@ -931,40 +931,40 @@ public class PropertyUtilsBean {
* @throws NoSuchMethodException if an accessor method for this
property cannot be found
*/
public Object getSimpleProperty(final Object bean, final String name)
throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
{
-<span class="nc" id="L934"> Objects.requireNonNull(bean,
"bean");</span>
-<span class="nc" id="L935"> Objects.requireNonNull(name,
"name");</span>
+<span class="fc" id="L934"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L935"> Objects.requireNonNull(name,
"name");</span>
// Validate the syntax of the property name
-<span class="nc bnc" id="L937" title="All 2 branches missed."> if
(resolver.hasNested(name)) {</span>
-<span class="nc" id="L938"> throw new
IllegalArgumentException("Nested property names are not allowed: Property
'" + name + "' on bean class '" + bean.getClass() +
"'");</span>
+<span class="fc bfc" id="L937" title="All 2 branches covered."> if
(resolver.hasNested(name)) {</span>
+<span class="fc" id="L938"> throw new
IllegalArgumentException("Nested property names are not allowed: Property
'" + name + "' on bean class '" + bean.getClass() +
"'");</span>
}
-<span class="nc bnc" id="L940" title="All 2 branches missed."> if
(resolver.isIndexed(name)) {</span>
-<span class="nc" id="L941"> throw new
IllegalArgumentException("Indexed property names are not allowed: Property
'" + name + "' on bean class '" + bean.getClass() +
"'");</span>
+<span class="fc bfc" id="L940" title="All 2 branches covered."> if
(resolver.isIndexed(name)) {</span>
+<span class="fc" id="L941"> throw new
IllegalArgumentException("Indexed property names are not allowed: Property
'" + name + "' on bean class '" + bean.getClass() +
"'");</span>
}
-<span class="nc bnc" id="L943" title="All 2 branches missed."> if
(resolver.isMapped(name)) {</span>
+<span class="pc bpc" id="L943" title="1 of 2 branches missed."> if
(resolver.isMapped(name)) {</span>
<span class="nc" id="L944"> throw new
IllegalArgumentException("Mapped property names are not allowed: Property
'" + name + "' on bean class '" + bean.getClass() +
"'");</span>
}
// Handle DynaBean instances specially
-<span class="nc bnc" id="L948" title="All 2 branches missed."> if (bean
instanceof DynaBean) {</span>
-<span class="nc" id="L949"> final DynaProperty descriptor =
((DynaBean) bean).getDynaClass().getDynaProperty(name);</span>
-<span class="nc bnc" id="L950" title="All 2 branches missed."> if
(descriptor == null) {</span>
-<span class="nc" id="L951"> throw new
NoSuchMethodException("Unknown property '" + name + "' on
dynaclass '" + ((DynaBean) bean).getDynaClass() + "'");</span>
+<span class="fc bfc" id="L948" title="All 2 branches covered."> if
(bean instanceof DynaBean) {</span>
+<span class="fc" id="L949"> final DynaProperty descriptor =
((DynaBean) bean).getDynaClass().getDynaProperty(name);</span>
+<span class="fc bfc" id="L950" title="All 2 branches covered."> if
(descriptor == null) {</span>
+<span class="fc" id="L951"> throw new
NoSuchMethodException("Unknown property '" + name + "' on
dynaclass '" + ((DynaBean) bean).getDynaClass() + "'");</span>
}
-<span class="nc" id="L953"> return ((DynaBean)
bean).get(name);</span>
+<span class="fc" id="L953"> return ((DynaBean)
bean).get(name);</span>
}
// Retrieve the property getter method for the specified property
-<span class="nc" id="L957"> final PropertyDescriptor descriptor =
getPropertyDescriptor(bean, name);</span>
-<span class="nc bnc" id="L958" title="All 2 branches missed."> if
(descriptor == null) {</span>
-<span class="nc" id="L959"> throw new
NoSuchMethodException("Unknown property '" + name + "' on class
'" + bean.getClass() + "'");</span>
- }
-<span class="nc" id="L961"> final Method readMethod =
getReadMethod(bean.getClass(), descriptor);</span>
-<span class="nc bnc" id="L962" title="All 2 branches missed."> if
(readMethod == null) {</span>
-<span class="nc" id="L963"> throw new
NoSuchMethodException("Property '" + name + "' has no getter
method in class '" + bean.getClass() + "'");</span>
+<span class="fc" id="L957"> final PropertyDescriptor descriptor =
getPropertyDescriptor(bean, name);</span>
+<span class="fc bfc" id="L958" title="All 2 branches covered."> if
(descriptor == null) {</span>
+<span class="fc" id="L959"> throw new
NoSuchMethodException("Unknown property '" + name + "' on class
'" + bean.getClass() + "'");</span>
+ }
+<span class="fc" id="L961"> final Method readMethod =
getReadMethod(bean.getClass(), descriptor);</span>
+<span class="fc bfc" id="L962" title="All 2 branches covered."> if
(readMethod == null) {</span>
+<span class="fc" id="L963"> throw new
NoSuchMethodException("Property '" + name + "' has no getter
method in class '" + bean.getClass() + "'");</span>
}
// Call the property getter and return the value
-<span class="nc" id="L967"> return invokeMethod(readMethod, bean,
BeanUtils.EMPTY_OBJECT_ARRAY);</span>
+<span class="fc" id="L967"> return invokeMethod(readMethod, bean,
BeanUtils.EMPTY_OBJECT_ARRAY);</span>
}
/**
@@ -988,8 +988,8 @@ public class PropertyUtilsBean {
* @since 1.9.1
*/
public Method getWriteMethod(final Class<?> clazz, final
PropertyDescriptor descriptor) {
-<span class="nc" id="L991"> final BeanIntrospectionData data =
getIntrospectionData(clazz);</span>
-<span class="nc" id="L992"> return
MethodUtils.getAccessibleMethod(clazz, data.getWriteMethod(clazz,
descriptor));</span>
+<span class="fc" id="L991"> final BeanIntrospectionData data =
getIntrospectionData(clazz);</span>
+<span class="fc" id="L992"> return
MethodUtils.getAccessibleMethod(clazz, data.getWriteMethod(clazz,
descriptor));</span>
}
/**
@@ -1009,7 +1009,7 @@ public class PropertyUtilsBean {
* @return The write method
*/
public Method getWriteMethod(final PropertyDescriptor descriptor) {
-<span class="nc" id="L1012"> return
MethodUtils.getAccessibleMethod(descriptor.getWriteMethod());</span>
+<span class="fc" id="L1012"> return
MethodUtils.getAccessibleMethod(descriptor.getWriteMethod());</span>
}
/**
@@ -1018,39 +1018,39 @@ public class PropertyUtilsBean {
* @see Method#invoke(Object, Object...)
*/
private Object invokeMethod(final Method method, final Object bean, final
Object... values) throws IllegalAccessException, InvocationTargetException {
-<span class="nc" id="L1021"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L1021"> Objects.requireNonNull(bean,
"bean");</span>
try {
-<span class="nc" id="L1023"> return method.invoke(bean,
values);</span>
-<span class="nc" id="L1024"> } catch (final NullPointerException |
IllegalArgumentException cause) {</span>
+<span class="fc" id="L1023"> return method.invoke(bean,
values);</span>
+<span class="fc" id="L1024"> } catch (final NullPointerException |
IllegalArgumentException cause) {</span>
// JDK 1.3 and JDK 1.4 throw NullPointerException if an argument is
// null for a primitive value (JDK 1.5+ throw
IllegalArgumentException)
-<span class="nc" id="L1027"> final StringBuilder valueString = new
StringBuilder();</span>
-<span class="nc bnc" id="L1028" title="All 2 branches missed."> if
(values != null) {</span>
-<span class="nc bnc" id="L1029" title="All 2 branches missed.">
for (int i = 0; i < values.length; i++) {</span>
-<span class="nc bnc" id="L1030" title="All 2 branches missed.">
if (i > 0) {</span>
+<span class="fc" id="L1027"> final StringBuilder valueString = new
StringBuilder();</span>
+<span class="pc bpc" id="L1028" title="1 of 2 branches missed."> if
(values != null) {</span>
+<span class="fc bfc" id="L1029" title="All 2 branches covered.">
for (int i = 0; i < values.length; i++) {</span>
+<span class="pc bpc" id="L1030" title="1 of 2 branches missed.">
if (i > 0) {</span>
<span class="nc" id="L1031"> valueString.append(",
");</span>
}
-<span class="nc bnc" id="L1033" title="All 2 branches missed.">
if (values[i] == null) {</span>
-<span class="nc" id="L1034">
valueString.append("<null>");</span>
-<span class="nc" id="L1035"> } else {</span>
-<span class="nc" id="L1036">
valueString.append(values[i].getClass().getName());</span>
+<span class="fc bfc" id="L1033" title="All 2 branches covered.">
if (values[i] == null) {</span>
+<span class="fc" id="L1034">
valueString.append("<null>");</span>
+ } else {
+<span class="fc" id="L1036">
valueString.append(values[i].getClass().getName());</span>
}
}
}
-<span class="nc" id="L1040"> final StringBuilder expectedString =
new StringBuilder();</span>
-<span class="nc" id="L1041"> final Class<?>[] parTypes =
method.getParameterTypes();</span>
-<span class="nc bnc" id="L1042" title="All 2 branches missed."> if
(parTypes != null) {</span>
-<span class="nc bnc" id="L1043" title="All 2 branches missed.">
for (int i = 0; i < parTypes.length; i++) {</span>
-<span class="nc bnc" id="L1044" title="All 2 branches missed.">
if (i > 0) {</span>
+<span class="fc" id="L1040"> final StringBuilder expectedString =
new StringBuilder();</span>
+<span class="fc" id="L1041"> final Class<?>[] parTypes =
method.getParameterTypes();</span>
+<span class="pc bpc" id="L1042" title="1 of 2 branches missed."> if
(parTypes != null) {</span>
+<span class="fc bfc" id="L1043" title="All 2 branches covered.">
for (int i = 0; i < parTypes.length; i++) {</span>
+<span class="pc bpc" id="L1044" title="1 of 2 branches missed.">
if (i > 0) {</span>
<span class="nc" id="L1045">
expectedString.append(", ");</span>
}
-<span class="nc" id="L1047">
expectedString.append(parTypes[i].getName());</span>
+<span class="fc" id="L1047">
expectedString.append(parTypes[i].getName());</span>
}
}
-<span class="nc" id="L1050"> throw new
IllegalArgumentException("Cannot invoke " +
method.getDeclaringClass().getName() + "." + method.getName() +
" on bean class '"</span>
-<span class="nc" id="L1051"> + bean.getClass() + "' -
" + cause.getMessage()</span>
+<span class="fc" id="L1050"> throw new
IllegalArgumentException("Cannot invoke " +
method.getDeclaringClass().getName() + "." + method.getName() +
" on bean class '"</span>
+<span class="fc" id="L1051"> + bean.getClass() + "' -
" + cause.getMessage()</span>
// as per
https://issues.apache.org/jira/browse/BEANUTILS-224
-<span class="nc" id="L1053"> + " - had objects of type
\"" + valueString + "\" but expected signature
\"" + expectedString + "\"", cause);</span>
+ + " - had objects of type \"" + valueString
+ "\" but expected signature \"" + expectedString +
"\"", cause);
}
}
@@ -1065,51 +1065,51 @@ public class PropertyUtilsBean {
*/
public boolean isReadable(Object bean, String name) {
// Validate method parameters
-<span class="nc" id="L1068"> Objects.requireNonNull(bean,
"bean");</span>
-<span class="nc" id="L1069"> Objects.requireNonNull(name,
"name");</span>
+<span class="fc" id="L1068"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L1069"> Objects.requireNonNull(name,
"name");</span>
// Resolve nested references
-<span class="nc bnc" id="L1071" title="All 2 branches missed."> while
(resolver.hasNested(name)) {</span>
-<span class="nc" id="L1072"> final String next =
resolver.next(name);</span>
-<span class="nc" id="L1073"> Object nestedBean = null;</span>
+<span class="fc bfc" id="L1071" title="All 2 branches covered."> while
(resolver.hasNested(name)) {</span>
+<span class="fc" id="L1072"> final String next =
resolver.next(name);</span>
+<span class="fc" id="L1073"> Object nestedBean = null;</span>
try {
-<span class="nc" id="L1075"> nestedBean = getProperty(bean,
next);</span>
+<span class="fc" id="L1075"> nestedBean = getProperty(bean,
next);</span>
<span class="nc" id="L1076"> } catch (final IllegalAccessException
| NoSuchMethodException | InvocationTargetException e) {</span>
<span class="nc" id="L1077"> return false;</span>
- }
-<span class="nc bnc" id="L1079" title="All 2 branches missed."> if
(nestedBean == null) {</span>
-<span class="nc" id="L1080"> throw new
NestedNullException("Null property value for '" + next + "' on
bean class '" + bean.getClass() + "'");</span>
- }
-<span class="nc" id="L1082"> bean = nestedBean;</span>
-<span class="nc" id="L1083"> name = resolver.remove(name);</span>
- }
+<span class="fc" id="L1078"> }</span>
+<span class="fc bfc" id="L1079" title="All 2 branches covered."> if
(nestedBean == null) {</span>
+<span class="fc" id="L1080"> throw new
NestedNullException("Null property value for '" + next + "' on
bean class '" + bean.getClass() + "'");</span>
+ }
+<span class="fc" id="L1082"> bean = nestedBean;</span>
+<span class="fc" id="L1083"> name = resolver.remove(name);</span>
+<span class="fc" id="L1084"> }</span>
// Remove any subscript from the final name value
-<span class="nc" id="L1087"> name = resolver.getProperty(name);</span>
+<span class="fc" id="L1087"> name = resolver.getProperty(name);</span>
// Treat WrapDynaBean as special case - may be a write-only property
// (see Jira issue# BEANUTILS-61)
-<span class="nc bnc" id="L1091" title="All 2 branches missed."> if
(bean instanceof WrapDynaBean) {</span>
-<span class="nc" id="L1092"> bean = ((WrapDynaBean)
bean).getInstance();</span>
+<span class="fc bfc" id="L1091" title="All 2 branches covered."> if
(bean instanceof WrapDynaBean) {</span>
+<span class="fc" id="L1092"> bean = ((WrapDynaBean)
bean).getInstance();</span>
}
// Return the requested result
-<span class="nc bnc" id="L1096" title="All 2 branches missed."> if
(bean instanceof DynaBean) {</span>
+<span class="fc bfc" id="L1096" title="All 2 branches covered."> if
(bean instanceof DynaBean) {</span>
// All DynaBean properties are readable
-<span class="nc bnc" id="L1098" title="All 2 branches missed.">
return ((DynaBean) bean).getDynaClass().getDynaProperty(name) != null;</span>
+<span class="pc bpc" id="L1098" title="1 of 2 branches missed.">
return ((DynaBean) bean).getDynaClass().getDynaProperty(name) != null;</span>
}
try {
-<span class="nc" id="L1101"> final PropertyDescriptor desc =
getPropertyDescriptor(bean, name);</span>
-<span class="nc bnc" id="L1102" title="All 2 branches missed."> if
(desc != null) {</span>
-<span class="nc" id="L1103"> Method readMethod =
getReadMethod(bean.getClass(), desc);</span>
-<span class="nc bnc" id="L1104" title="All 2 branches missed.">
if (readMethod == null) {</span>
-<span class="nc bnc" id="L1105" title="All 2 branches missed.">
if (desc instanceof IndexedPropertyDescriptor) {</span>
-<span class="nc" id="L1106"> readMethod =
((IndexedPropertyDescriptor) desc).getIndexedReadMethod();</span>
-<span class="nc bnc" id="L1107" title="All 2 branches missed.">
} else if (desc instanceof MappedPropertyDescriptor) {</span>
-<span class="nc" id="L1108"> readMethod =
((MappedPropertyDescriptor) desc).getMappedReadMethod();</span>
+<span class="fc" id="L1101"> final PropertyDescriptor desc =
getPropertyDescriptor(bean, name);</span>
+<span class="pc bpc" id="L1102" title="1 of 2 branches missed."> if
(desc != null) {</span>
+<span class="fc" id="L1103"> Method readMethod =
getReadMethod(bean.getClass(), desc);</span>
+<span class="fc bfc" id="L1104" title="All 2 branches covered.">
if (readMethod == null) {</span>
+<span class="fc bfc" id="L1105" title="All 2 branches covered.">
if (desc instanceof IndexedPropertyDescriptor) {</span>
+<span class="fc" id="L1106"> readMethod =
((IndexedPropertyDescriptor) desc).getIndexedReadMethod();</span>
+<span class="fc bfc" id="L1107" title="All 2 branches covered.">
} else if (desc instanceof MappedPropertyDescriptor) {</span>
+<span class="fc" id="L1108"> readMethod =
((MappedPropertyDescriptor) desc).getMappedReadMethod();</span>
}
-<span class="nc" id="L1110"> readMethod =
MethodUtils.getAccessibleMethod(bean.getClass(), readMethod);</span>
+<span class="fc" id="L1110"> readMethod =
MethodUtils.getAccessibleMethod(bean.getClass(), readMethod);</span>
}
-<span class="nc bnc" id="L1112" title="All 2 branches missed.">
return readMethod != null;</span>
+<span class="fc bfc" id="L1112" title="All 2 branches covered.">
return readMethod != null;</span>
}
<span class="nc" id="L1114"> return false;</span>
<span class="nc" id="L1115"> } catch (final IllegalAccessException |
NoSuchMethodException | InvocationTargetException e) {</span>
@@ -1128,53 +1128,53 @@ public class PropertyUtilsBean {
*/
public boolean isWriteable(Object bean, String name) {
// Validate method parameters
-<span class="nc" id="L1131"> Objects.requireNonNull(bean,
"bean");</span>
-<span class="nc" id="L1132"> Objects.requireNonNull(name,
"name");</span>
+<span class="fc" id="L1131"> Objects.requireNonNull(bean,
"bean");</span>
+<span class="fc" id="L1132"> Objects.requireNonNull(name,
"name");</span>
// Resolve nested references
-<span class="nc bnc" id="L1134" title="All 2 branches missed."> while
(resolver.hasNested(name)) {</span>
-<span class="nc" id="L1135"> final String next =
resolver.next(name);</span>
-<span class="nc" id="L1136"> Object nestedBean = null;</span>
+<span class="fc bfc" id="L1134" title="All 2 branches covered."> while
(resolver.hasNested(name)) {</span>
+<span class="fc" id="L1135"> final String next =
resolver.next(name);</span>
+<span class="fc" id="L1136"> Object nestedBean = null;</span>
try {
-<span class="nc" id="L1138"> nestedBean = getProperty(bean,
next);</span>
+<span class="fc" id="L1138"> nestedBean = getProperty(bean,
next);</span>
<span class="nc" id="L1139"> } catch (final IllegalAccessException
| NoSuchMethodException | InvocationTargetException e) {</span>
<span class="nc" id="L1140"> return false;</span>
- }
-<span class="nc bnc" id="L1142" title="All 2 branches missed."> if
(nestedBean == null) {</span>
-<span class="nc" id="L1143"> throw new
NestedNullException("Null property value for '" + next + "' on
bean class '" + bean.getClass() + "'");</span>
- }
-<span class="nc" id="L1145"> bean = nestedBean;</span>
-<span class="nc" id="L1146"> name = resolver.remove(name);</span>
- }
+<span class="fc" id="L1141"> }</span>
+<span class="fc bfc" id="L1142" title="All 2 branches covered."> if
(nestedBean == null) {</span>
+<span class="fc" id="L1143"> throw new
NestedNullException("Null property value for '" + next + "' on
bean class '" + bean.getClass() + "'");</span>
+ }
+<span class="fc" id="L1145"> bean = nestedBean;</span>
+<span class="fc" id="L1146"> name = resolver.remove(name);</span>
+<span class="fc" id="L1147"> }</span>
// Remove any subscript from the final name value
-<span class="nc" id="L1150"> name = resolver.getProperty(name);</span>
+<span class="fc" id="L1150"> name = resolver.getProperty(name);</span>
// Treat WrapDynaBean as special case - may be a read-only property
// (see Jira issue# BEANUTILS-61)
-<span class="nc bnc" id="L1154" title="All 2 branches missed."> if
(bean instanceof WrapDynaBean) {</span>
-<span class="nc" id="L1155"> bean = ((WrapDynaBean)
bean).getInstance();</span>
+<span class="fc bfc" id="L1154" title="All 2 branches covered."> if
(bean instanceof WrapDynaBean) {</span>
+<span class="fc" id="L1155"> bean = ((WrapDynaBean)
bean).getInstance();</span>
}
// Return the requested result
-<span class="nc bnc" id="L1159" title="All 2 branches missed."> if
(bean instanceof DynaBean) {</span>
+<span class="fc bfc" id="L1159" title="All 2 branches covered."> if
(bean instanceof DynaBean) {</span>
// All DynaBean properties are writable
-<span class="nc bnc" id="L1161" title="All 2 branches missed.">
return ((DynaBean) bean).getDynaClass().getDynaProperty(name) != null;</span>
+<span class="fc bfc" id="L1161" title="All 2 branches covered.">
return ((DynaBean) bean).getDynaClass().getDynaProperty(name) != null;</span>
}
try {
-<span class="nc" id="L1164"> final PropertyDescriptor desc =
getPropertyDescriptor(bean, name);</span>
-<span class="nc bnc" id="L1165" title="All 2 branches missed."> if
(desc != null) {</span>
-<span class="nc" id="L1166"> Method writeMethod =
getWriteMethod(bean.getClass(), desc);</span>
-<span class="nc bnc" id="L1167" title="All 2 branches missed.">
if (writeMethod == null) {</span>
-<span class="nc bnc" id="L1168" title="All 2 branches missed.">
if (desc instanceof IndexedPropertyDescriptor) {</span>
-<span class="nc" id="L1169"> writeMethod =
((IndexedPropertyDescriptor) desc).getIndexedWriteMethod();</span>
-<span class="nc bnc" id="L1170" title="All 2 branches missed.">
} else if (desc instanceof MappedPropertyDescriptor) {</span>
-<span class="nc" id="L1171"> writeMethod =
((MappedPropertyDescriptor) desc).getMappedWriteMethod();</span>
+<span class="fc" id="L1164"> final PropertyDescriptor desc =
getPropertyDescriptor(bean, name);</span>
+<span class="fc bfc" id="L1165" title="All 2 branches covered."> if
(desc != null) {</span>
+<span class="fc" id="L1166"> Method writeMethod =
getWriteMethod(bean.getClass(), desc);</span>
+<span class="fc bfc" id="L1167" title="All 2 branches covered.">
if (writeMethod == null) {</span>
+<span class="fc bfc" id="L1168" title="All 2 branches covered.">
if (desc instanceof IndexedPropertyDescriptor) {</span>
+<span class="fc" id="L1169"> writeMethod =
((IndexedPropertyDescriptor) desc).getIndexedWriteMethod();</span>
+<span class="fc bfc" id="L1170" title="All 2 branches covered.">
} else if (desc instanceof MappedPropertyDescriptor) {</span>
+<span class="fc" id="L1171"> writeMethod =
((MappedPropertyDescriptor) desc).getMappedWriteMethod();</span>
}
[... 507 lines stripped ...]