Example usage for java.beans PropertyDescriptor getReadMethod

List of usage examples for java.beans PropertyDescriptor getReadMethod

Introduction

In this page you can find the example usage for java.beans PropertyDescriptor getReadMethod.

Prototype

public synchronized Method getReadMethod() 

Source Link

Document

Gets the method that should be used to read the property value.

Usage

From source file:net.firejack.platform.core.store.AbstractStore.java

@SuppressWarnings("unchecked")
protected Criterion parseAdvancedSearchRequest(List<SearchQuery> searchQueries, Map<String, String> aliases,
        boolean skipNotValidValues) {
    int index = 0;
    LinkedList<Criterion> criterions = new LinkedList<Criterion>();
    for (SearchQuery searchQuery : searchQueries) {
        Criterion criterion;//from w  w  w .j  a v a 2s .  co  m
        String field = searchQuery.getField();
        if (field == null) {
            criterions.add(Restrictions.sqlRestriction("1 = 1"));
        } else {
            String[] fieldNames = field.split("\\.");
            if (fieldNames.length == 1) {
                String fieldName = fieldNames[0];
                PropertyDescriptor propertyDescriptor = ClassUtils.getPropertyDescriptor(getClazz(), fieldName);
                if (propertyDescriptor != null) {
                    Method readMethod = propertyDescriptor.getReadMethod();
                    if (readMethod != null) {
                        Class<?> returnType = readMethod.getReturnType();
                        try {
                            criterion = getRestrictions(searchQuery, returnType);
                            criterions.add(criterion);
                        } catch (IllegalArgumentException e) {
                            if (!skipNotValidValues) {
                                throw new BusinessFunctionException(
                                        "The field '" + fieldName + "' has type '" + returnType.getName()
                                                + "', but value '" + searchQuery.getValue() + "' is incorrect");
                            }
                        }
                    } else {
                        throw new BusinessFunctionException("The field '" + fieldName
                                + "' has not read method in class '" + getClazz().getName() + "'");
                    }
                } else {
                    throw new BusinessFunctionException("The field '" + fieldName
                            + "' does not exist in class '" + getClazz().getName() + "'");
                }
            } else {
                Class<E> aClass = getClazz();
                String indexedFieldName = null;
                for (int i = 0; i < fieldNames.length; i++) {
                    String fieldName = fieldNames[i];
                    PropertyDescriptor propertyDescriptor = ClassUtils.getPropertyDescriptor(aClass, fieldName);
                    if (propertyDescriptor != null) {
                        Method readMethod = propertyDescriptor.getReadMethod();
                        if (readMethod != null) {
                            Class<?> returnType = readMethod.getReturnType();
                            if (Collection.class.isAssignableFrom(returnType)) {
                                returnType = (Class<?>) ((ParameterizedTypeImpl) readMethod
                                        .getGenericReturnType()).getActualTypeArguments()[0];
                            }
                            if (AbstractModel.class.isAssignableFrom(returnType)) {
                                aClass = (Class) returnType;
                                String alias = i == 0 ? fieldName : indexedFieldName + "." + fieldName;
                                indexedFieldName = aliases.get(alias);
                                if (indexedFieldName == null) {
                                    indexedFieldName = fieldName + index++;
                                    aliases.put(alias, indexedFieldName);
                                }
                            } else {
                                if (i == (fieldNames.length - 1)) {
                                    String queryFieldName = indexedFieldName + "." + fieldName;
                                    try {
                                        criterion = getRestrictions(new SearchQuery(queryFieldName,
                                                searchQuery.getOperation(), searchQuery.getValue()),
                                                returnType);
                                        criterions.add(criterion);
                                    } catch (IllegalArgumentException e) {
                                        if (!skipNotValidValues) {
                                            throw new BusinessFunctionException("The field '" + fieldName
                                                    + "' has type '" + returnType.getName() + "', but value '"
                                                    + searchQuery.getValue() + "' is incorrect");
                                        }
                                    }
                                } else {
                                    throw new BusinessFunctionException("Field name: '" + fieldName
                                            + "' is not correct in query: '" + field + "'");
                                }
                            }
                        } else {
                            throw new BusinessFunctionException("The field '" + fieldName
                                    + "' has not read method in class '" + aClass + "'");
                        }
                    } else {
                        throw new BusinessFunctionException(
                                "The field '" + fieldName + "' does not exist in class '" + aClass + "'");
                    }
                }
            }
        }
    }

    Criterion andCriterion = null;
    for (Criterion criterion : criterions) {
        andCriterion = criterions.getFirst() == criterion ? criterion
                : Restrictions.and(andCriterion, criterion);
    }
    return andCriterion;
}

From source file:com.bstek.dorado.config.xml.XmlParserHelper.java

protected void doInitObjectParser(Context context, ObjectParser objectParser, XmlNodeInfo xmlNodeInfo,
        Class<?> beanType) throws Exception {
    objectParser.setAnnotationOwnerType(beanType);
    if (!Modifier.isAbstract(beanType.getModifiers())) {
        objectParser.setImpl(beanType.getName());
    }//from  w  w w  . j  av  a2  s .c  om

    if (xmlNodeInfo != null) {
        if (StringUtils.isNotEmpty(xmlNodeInfo.getDefinitionType())) {
            objectParser.setDefinitionType(xmlNodeInfo.getDefinitionType());
        }

        Map<String, XmlParser> propertyParsers = objectParser.getPropertyParsers();
        Map<String, XmlParser> subParsers = objectParser.getSubParsers();

        if (!(objectParser instanceof CompositePropertyParser)) {
            boolean inheritable = objectParser.isInheritable() || xmlNodeInfo.isInheritable();
            objectParser.setInheritable(inheritable);
            if (inheritable) {
                if (propertyParsers.get("parent") == null) {
                    objectParser.registerPropertyParser("parent",
                            beanFactory.getBean(IGNORE_PARSER, XmlParser.class));
                }
            }

            boolean scopable = objectParser.isScopable() || xmlNodeInfo.isScopable();
            objectParser.setScopable(scopable);
            if (scopable) {
                if (propertyParsers.get("scope") == null) {
                    objectParser.registerPropertyParser("scope",
                            beanFactory.getBean(IGNORE_PARSER, XmlParser.class));
                }
            }

            for (String fixedProperty : xmlNodeInfo.getFixedProperties().keySet()) {
                if (propertyParsers.get(fixedProperty) == null) {
                    objectParser.registerPropertyParser(fixedProperty,
                            beanFactory.getBean(IGNORE_PARSER, XmlParser.class));
                }
            }
        }

        for (XmlSubNode xmlSubNode : xmlNodeInfo.getSubNodes()) {
            if (StringUtils.isNotEmpty(xmlSubNode.propertyType())) {
                List<XmlParserInfo> xmlParserInfos = getSubNodeXmlParserInfos(context, beanType,
                        xmlSubNode.propertyName(), null, xmlSubNode);
                if (xmlParserInfos != null) {
                    for (XmlParserInfo xmlParserInfo : xmlParserInfos) {
                        objectParser.registerSubParser(xmlParserInfo.getPath(), xmlParserInfo.getParser());
                    }
                }
            } else if (StringUtils.isNotEmpty(xmlSubNode.nodeName())
                    && StringUtils.isNotEmpty(xmlSubNode.parser())) {
                BeanWrapper beanWrapper = BeanFactoryUtils.getBean(xmlSubNode.parser(), Scope.instant);
                objectParser.registerSubParser(xmlSubNode.nodeName(), (XmlParser) beanWrapper.getBean());
            }
        }

        for (Map.Entry<String, XmlProperty> entry : xmlNodeInfo.getProperties().entrySet()) {
            XmlProperty xmlProperty = entry.getValue();
            XmlParserInfo xmlParserInfo = getPropertyXmlParserInfo(context, beanType,
                    xmlProperty.propertyName(), null, xmlProperty);
            if (xmlParserInfo != null) {
                objectParser.registerPropertyParser(xmlParserInfo.getPath(), xmlParserInfo.getParser());
            }
        }

        if (ClientEventSupported.class.isAssignableFrom(beanType) && subParsers.get("ClientEvent") == null) {
            objectParser.registerSubParser("ClientEvent",
                    beanFactory.getBean(CLIENT_EVENT_PARSER, XmlParser.class));
        }
    }

    PropertyDescriptor[] propertyDescriptors = PropertyUtils.getPropertyDescriptors(beanType);
    for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
        String propertyName = propertyDescriptor.getName();
        if ("class".equals(propertyName)) {
            continue;
        }

        Method readMethod = propertyDescriptor.getReadMethod();
        if (readMethod == null) {
            continue;
        }
        if (readMethod.getDeclaringClass() != beanType) {
            try {
                readMethod = beanType.getMethod(readMethod.getName(), readMethod.getParameterTypes());
            } catch (NoSuchMethodException e) {
                // do nothing
            }
        }

        TypeInfo typeInfo;
        Class<?> propertyType = propertyDescriptor.getPropertyType();
        if (Collection.class.isAssignableFrom(propertyType)) {
            typeInfo = TypeInfo.parse((ParameterizedType) readMethod.getGenericReturnType(), true);
            propertyType = typeInfo.getType();
        } else {
            typeInfo = new TypeInfo(propertyType, false);
        }

        XmlSubNode xmlSubNode = readMethod.getAnnotation(XmlSubNode.class);
        if (xmlSubNode != null) {
            if (StringUtils.isNotEmpty(xmlSubNode.propertyName())) {
                throw new IllegalArgumentException("@XmlSubNode.propertyName should be empty. ["
                        + beanType.getName() + '#' + propertyName + "]");
            }

            List<XmlParserInfo> xmlParserInfos = getSubNodeXmlParserInfos(context, beanType, propertyName,
                    typeInfo, xmlSubNode);
            if (xmlParserInfos != null) {
                for (XmlParserInfo xmlParserInfo : xmlParserInfos) {
                    objectParser.registerSubParser(xmlParserInfo.getPath(), xmlParserInfo.getParser());
                }
            }
        } else {
            XmlProperty xmlProperty = readMethod.getAnnotation(XmlProperty.class);
            if (xmlProperty != null && StringUtils.isNotEmpty(xmlProperty.propertyName())) {
                throw new IllegalArgumentException("@XmlProperty.propertyName should be empty. ["
                        + beanType.getName() + '#' + propertyName + "]");
            }

            XmlParserInfo xmlParserInfo = getPropertyXmlParserInfo(context, beanType, propertyName, typeInfo,
                    xmlProperty);
            if (xmlParserInfo != null) {
                XmlParser parser = xmlParserInfo.getParser();
                if (parser instanceof TextPropertyParser) {
                    TextPropertyParser textPropertyParser = (TextPropertyParser) parser;
                    if (textPropertyParser.getTextParser() == null) {
                        TextParser textParser = textParserHelper.getTextParser(propertyType);
                        textPropertyParser.setTextParser(textParser);
                    }
                }
                objectParser.registerPropertyParser(xmlParserInfo.getPath(), parser);
            }
        }
    }

    if (objectParser instanceof ObjectParserInitializationAware) {
        ((ObjectParserInitializationAware) objectParser).postObjectParserInitialized(objectParser);
    }

    Map<String, XmlParserHelperListener> listenerMap = ((ListableBeanFactory) beanFactory)
            .getBeansOfType(XmlParserHelperListener.class);
    for (XmlParserHelperListener listener : listenerMap.values()) {
        listener.onInitParser(this, objectParser, beanType);
    }
}

From source file:loxia.support.json.JSONObject.java

@SuppressWarnings("unchecked")
public void setObject(Object bean, String propFilterStr) {
    JSONPropFilter filter = new JSONPropFilter(propFilterStr, objStrTransferMap.keySet());
    this.myHashMap = new HashMap<String, Object>();
    PropertyDescriptor[] props = PropertyUtils.getPropertyDescriptors(bean.getClass());
    for (PropertyDescriptor prop : props) {
        if ("class".equals(prop.getName()))
            continue;
        if (prop.getReadMethod() != null) {
            String key = prop.getName();
            try {
                Object value = prop.getReadMethod().invoke(bean, (Object[]) null);

                if (filter.isValid(key, value)) {
                    if (value == null) {
                        Class<? extends Object> c = prop.getReadMethod().getReturnType();
                        if (Map.class.isAssignableFrom(c) || Collection.class.isAssignableFrom(c)
                                || c.isArray())
                            continue;
                        this.myHashMap.put(key, NULL);
                    } else if (value instanceof Map) {
                        Map<String, Object> m = (Map<String, Object>) value;
                        this.myHashMap.put(key, new JSONObject(m, filter.getFilterStr(key), objStrTransferMap));
                    } else if (value instanceof Collection) {
                        Collection<? extends Object> c = (Collection<? extends Object>) value;
                        this.myHashMap.put(key, new JSONArray(c, filter.getFilterStr(key), objStrTransferMap));
                    } else if (value.getClass().isArray()) {
                        this.myHashMap.put(key,
                                new JSONArray(value, filter.getFilterStr(key), objStrTransferMap));
                    } else if (filter.isSupportedClass(value)) {
                        this.put(key, value);
                    } else {
                        this.myHashMap.put(key,
                                new JSONObject(value, filter.getFilterStr(key), objStrTransferMap));
                    }//from   ww w.j av a2s . c  om
                }
            } catch (Exception e) {
                e.printStackTrace();
                //do nothing
            }
        }
    }

    /*Class<? extends Object> klass = bean.getClass();
     Method[] methods = klass.getMethods();
     for (int i = 0; i < methods.length; i += 1) {
    try {
        Method method = methods[i];
        String name = method.getName();
        String key = "";
        if (name.startsWith("get")) {
            key = name.substring(3);
        } else if (name.startsWith("is")) {
            key = name.substring(2);
        }
        if (key.length() > 0 &&
                Character.isUpperCase(key.charAt(0)) &&
                method.getParameterTypes().length == 0) {
            if (key.length() == 1) {
                key = key.toLowerCase();
            } else if (!Character.isUpperCase(key.charAt(1))) {
                key = key.substring(0, 1).toLowerCase() +
                    key.substring(1);
            }
            Object value = method.invoke(bean, (Object[])null);
                    
            if(filter.isValid(key,value)){ 
               if(value == null){ 
                  Class<? extends Object> c = method.getReturnType();
                  if(Map.class.isAssignableFrom(c) ||
                        Collection.class.isAssignableFrom(c) ||
                        c.isArray()) continue;
                  this.myHashMap.put(key, NULL);                          
               }else if(value instanceof Map){
                Map<String,Object> m = (Map<String,Object>) value;
                this.myHashMap.put(key, new JSONObject(m,filter.getFilterStr(key),objStrTransferMap));
             }else if(value instanceof Collection){
                Collection<? extends Object> c = (Collection<? extends Object>)value;
                this.myHashMap.put(key, new JSONArray(c,filter.getFilterStr(key),objStrTransferMap));
             }else if(value.getClass().isArray()){
                this.myHashMap.put(key, new JSONArray(value,filter.getFilterStr(key),objStrTransferMap));
             }else if(filter.isSupportedClass(value)){
                this.put(key, value);
             }else{
                this.myHashMap.put(key, new JSONObject(value,filter.getFilterStr(key),objStrTransferMap));
             }
          }
        }
    } catch (Exception e) {
       e.printStackTrace();
                
    }
     }*/
}

From source file:net.yasion.common.core.bean.wrapper.impl.ExtendedBeanWrapperImpl.java

@Override
public boolean isReadableProperty(String propertyName) {
    try {/*w w  w. ja  v a2 s.com*/
        PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName);
        if (pd != null) {
            if (pd.getReadMethod() != null) {
                return true;
            }
        } else {
            // Maybe an indexed/mapped property...
            getPropertyValue(propertyName);
            return true;
        }
    } catch (InvalidPropertyException ex) {
        // Cannot be evaluated, so can't be readable.
    }
    return false;
}

From source file:org.jdbcluster.privilege.PrivilegeCheckerImpl.java

/**
 * calculates instance and parameter specific privileges
 * //w  w  w  .  jav a  2s .  co  m
 * @param clusterObject cluster object instance
 * @param calledMethod the method called
 * @param args method parameters
 * @return return reqired privileges
 */
private Set<String> getDynamicPrivilegesCluster(PrivilegedCluster clusterObject, Method calledMethod,
        Object[] args) {
    DomainChecker dc = DomainCheckerImpl.getInstance();
    Set<String> result = new HashSet<String>();
    PrivilegesCluster pcAnno = clusterObject.getClass().getAnnotation(PrivilegesCluster.class);

    if (pcAnno == null || pcAnno.property().length == 0 || pcAnno.property()[0].length() == 0)
        return result;

    if (isGetMethodInRequiredProperty(pcAnno.property(), calledMethod))
        return result;

    getBeanWrapper().setWrappedInstance(clusterObject);

    for (String propertyPath : pcAnno.property()) {

        PropertyDescriptor pd = getPropertyDescriptor(propertyPath, getBeanWrapper());

        if (pd != null) {
            Field f = getPropertyField(propertyPath, pd);
            String domId = getDomainIdFromField(f);
            DomainPrivilegeList dpl;
            try {
                dpl = (DomainPrivilegeList) dc.getDomainListInstance(domId);
            } catch (ClassCastException e) {
                throw new ConfigurationException(
                        "privileged domain [" + domId + "] needs implemented DomainPrivilegeList Interface", e);
            }
            if (!(pd.getReadMethod().equals(calledMethod) || pd.getWriteMethod().equals(calledMethod))) {
                String value = getPropertyValue(propertyPath, getBeanWrapper());
                Set<String> setToAdd = dpl.getDomainEntryPivilegeList(domId, value);
                if (setToAdd != null)
                    result.addAll(setToAdd);
            } else {
                if (pd.getWriteMethod().equals(calledMethod)) {
                    if ((args.length != 1 || !(args[0] instanceof String)) && args[0] != null)
                        throw new ConfigurationException("privilege checked property [" + propertyPath
                                + "] needs 1 String argument setter");
                    Set<String> ergList = dpl.getDomainEntryPivilegeList(domId, (String) args[0]);
                    if (ergList != null)
                        result.addAll(ergList);
                }
            }
        }
    }
    return result;
}

From source file:org.ajax4jsf.templatecompiler.el.ELCompiler.java

private boolean processingValue(AstValue node, StringBuffer sb, CompilationContext componentBean) {
    String lastIndexValue = "null";
    String lastVariableType = null;
    List<String> names = new ArrayList<String>();

    for (int i = 0; i < node.jjtGetNumChildren(); i++) {
        StringBuffer sb1 = new StringBuffer();
        Node subChild = node.jjtGetChild(i);

        if (subChild instanceof AstIdentifier) {
            String variableName = subChild.getImage();
            if (componentBean.containsVariable(variableName)) {
                lastVariableType = componentBean.getVariableType(variableName).getName();
                names.add(variableName);
            } else {
                processingIdentifier((AstIdentifier) subChild, sb1, componentBean);
            }//from  ww w . j av a 2  s  . com
        } else if (subChild instanceof AstDotSuffix) {
            String propertyName = subChild.getImage();
            log.debug("Object: " + lastVariableType + ", property: " + propertyName);

            if (lastVariableType != null) {
                try {

                    Class<?> clazz = componentBean.loadClass(lastVariableType);

                    PropertyDescriptor propertyDescriptor = getPropertyDescriptor(clazz, propertyName,
                            componentBean);

                    if (propertyDescriptor == null) {
                        throw new PropertyNotFoundException(
                                "property: " + propertyName + " not found in class: " + lastVariableType);
                    }

                    log.debug("propertyObject: " + propertyDescriptor.getPropertyType().getName());
                    StringBuffer tmpbuf = new StringBuffer();
                    tmpbuf.append(propertyDescriptor.getReadMethod().getName());
                    tmpbuf.append("()");
                    names.add(tmpbuf.toString());

                    lastVariableType = propertyDescriptor.getPropertyType().getName();
                } catch (ClassNotFoundException e) {
                    log.error(e.getLocalizedMessage(), e);
                }

            } else {

                sb1.append("getProperty(");
                sb1.append(lastIndexValue);
                sb1.append(",");
                sb1.append("\"");
                sb1.append(subChild.getImage());
                sb1.append("\")");
            }
        } else if (subChild instanceof AstBracketSuffix) {
            String bracketSuffix = processingBracketSuffix((AstBracketSuffix) subChild, componentBean);

            if (lastVariableType != null) {
                StringBuffer tmpbuf = new StringBuffer();
                if (lastVariableType.startsWith("[L")) {
                    tmpbuf.append("[");
                    tmpbuf.append(bracketSuffix);
                    tmpbuf.append("]");
                    names.add(tmpbuf.toString());
                }

                if ((lastVariableType.compareTo("java.util.List") == 0)
                        || (lastVariableType.compareTo("java.util.Map") == 0)) {
                    tmpbuf.append("get(");
                    tmpbuf.append(bracketSuffix);
                    tmpbuf.append(")");
                    names.add(tmpbuf.toString());
                }
            } else {

                sb1.append("getElelmentByIndex(");
                sb1.append(lastIndexValue);
                sb1.append(",");
                sb1.append(bracketSuffix);
                sb1.append(")");
            }

        }

    }

    if (names.size() != 0) {
        StringBuffer tmpbuf = new StringBuffer();
        for (String element : names) {
            if (tmpbuf.length() != 0) {
                tmpbuf.append(".");
            }
            tmpbuf.append(element);
        }
        sb.append(tmpbuf.toString());
    } else {
        sb.append(lastIndexValue);
    }

    return true;
}

From source file:com.expressui.core.view.field.FormField.java

private String getToolTipTextFromAnnotation() {
    Class propertyContainerType = getBeanPropertyType().getContainerType();
    String propertyIdRelativeToContainerType = getBeanPropertyType().getId();
    PropertyDescriptor descriptor = BeanUtils.getPropertyDescriptor(propertyContainerType,
            propertyIdRelativeToContainerType);
    Method method = descriptor.getReadMethod();
    ToolTip toolTipAnnotation = method.getAnnotation(ToolTip.class);
    if (toolTipAnnotation == null) {
        return null;
    } else {/*  w  w w .j  a  va2s  .c o  m*/
        return toolTipAnnotation.value();
    }
}

From source file:nl.strohalm.cyclos.services.customization.BaseCustomFieldServiceImpl.java

@SuppressWarnings("unchecked")
private void copyParentProperties(final CustomField parent, final CustomField child) {
    final PropertyDescriptor[] propertyDescriptors = PropertyUtils.getPropertyDescriptors(parent);
    for (final PropertyDescriptor propertyDescriptor : propertyDescriptors) {
        final String name = propertyDescriptor.getName();
        final boolean isWritable = propertyDescriptor.getWriteMethod() != null;
        final boolean isReadable = propertyDescriptor.getReadMethod() != null;
        if (isReadable && isWritable && !EXCLUDED_PROPERTIES_FOR_DEPENDENT_FIELDS.contains(name)) {
            Object value = PropertyHelper.get(parent, name);
            if (value instanceof Collection) {
                value = new ArrayList<Object>((Collection<Object>) value);
            }/*  w  w w .ja  v a 2 s .  c o m*/
            PropertyHelper.set(child, name, value);
        }
    }
}

From source file:com.complexible.pinto.RDFMapper.java

private RdfProperty getPropertyAnnotation(final PropertyDescriptor thePropertyDescriptor) {
    Method aMethod = null;//from w  w  w.  ja  va  2 s.co  m

    if (thePropertyDescriptor == null) {
        return null;
    }

    if (Methods.annotated(RdfProperty.class).test(thePropertyDescriptor.getReadMethod())) {
        aMethod = thePropertyDescriptor.getReadMethod();
    } else if (Methods.annotated(RdfProperty.class).test(thePropertyDescriptor.getWriteMethod())) {
        aMethod = thePropertyDescriptor.getWriteMethod();
    }

    if (aMethod == null) {
        return null;
    } else {
        return aMethod.getAnnotation(RdfProperty.class);
    }
}

From source file:de.hybris.platform.webservices.AbstractWebServicesTest.java

/**
 * Checks in loop if the given properties of the object are null <br/>
 * if at least one is not null, than AssertionError is thrown <br/>
 * //from w  ww.  j  a  v a2 s  .  c  o m
 * @param objectsList
 *           list of objects to check
 * @param objectsClass
 *           class of objects in the list
 * @param properties
 *           properties to check
 */
protected void assertIsNull(final List objectsList, final Class objectsClass, final String... properties) {
    final Map<String, PropertyDescriptor> pdMap = getPropertyDescriptors(objectsClass);
    for (final Object dto : objectsList) {
        for (final String property : properties) {
            final PropertyDescriptor propDesc = pdMap.get(property);
            if (propDesc == null) {
                Assert.fail("Property '" + property + "' not available");
            }
            Object actualProp = null;
            try {
                actualProp = propDesc.getReadMethod().invoke(dto, (Object[]) null); //NOPMD
            } catch (final Exception e) {
                LOG.error(e.getMessage(), e);
                Assert.fail();
            }

            final String msg = dto.getClass().getSimpleName() + ": value of '" + property + "' is null";
            Assert.assertNull(msg, actualProp);
        }
    }
}