Example usage for org.apache.commons.beanutils PropertyUtils getPropertyDescriptor

List of usage examples for org.apache.commons.beanutils PropertyUtils getPropertyDescriptor

Introduction

In this page you can find the example usage for org.apache.commons.beanutils PropertyUtils getPropertyDescriptor.

Prototype

public static PropertyDescriptor getPropertyDescriptor(Object bean, String name)
        throws IllegalAccessException, InvocationTargetException, NoSuchMethodException 

Source Link

Document

Retrieve the property descriptor for the specified property of the specified bean, or return null if there is no such descriptor.

For more details see PropertyUtilsBean.

Usage

From source file:org.kuali.kfs.module.ar.businessobject.lookup.ContractsGrantsInvoiceLookupableHelperServiceImpl.java

/**
 * @param element// ww w . java 2  s  .com
 * @param attributeName
 * @return Column
 */
protected Column setupResultsColumn(BusinessObject element, String attributeName,
        BusinessObjectRestrictions businessObjectRestrictions) {
    Column col = new Column();

    col.setPropertyName(attributeName);

    String columnTitle = getDataDictionaryService().getAttributeLabel(element.getClass(), attributeName);
    if (StringUtils.isBlank(columnTitle)) {
        columnTitle = getDataDictionaryService().getCollectionLabel(element.getClass(), attributeName);
    }
    col.setColumnTitle(columnTitle);
    col.setMaxLength(getDataDictionaryService().getAttributeMaxLength(element.getClass(), attributeName));

    try {
        Class formatterClass = getDataDictionaryService().getAttributeFormatter(element.getClass(),
                attributeName);
        Formatter formatter = null;
        if (formatterClass != null) {
            formatter = (Formatter) formatterClass.newInstance();
            col.setFormatter(formatter);
        }

        // Pick off result column from result list, do formatting
        String propValue = KFSConstants.EMPTY_STRING;
        Object prop = ObjectUtils.getPropertyValue(element, attributeName);

        // Set comparator and formatter based on property type
        Class propClass = null;

        PropertyDescriptor propDescriptor = PropertyUtils.getPropertyDescriptor(element, col.getPropertyName());
        if (propDescriptor != null) {
            propClass = propDescriptor.getPropertyType();
        }

        // Formatters
        if (prop != null) {
            propValue = getContractsGrantsReportHelperService().formatByType(prop, formatter);
        }

        // Comparator
        col.setComparator(CellComparatorHelper.getAppropriateComparatorForPropertyClass(propClass));
        col.setValueComparator(CellComparatorHelper.getAppropriateValueComparatorForPropertyClass(propClass));
        propValue = super.maskValueIfNecessary(element.getClass(), col.getPropertyName(), propValue,
                businessObjectRestrictions);
        col.setPropertyValue(propValue);

        if (StringUtils.isNotBlank(propValue)) {
            col.setColumnAnchor(getInquiryUrl(element, col.getPropertyName()));
        }
    } catch (InstantiationException ie) {
        throw new RuntimeException(
                "Unable to get new instance of formatter class for property " + col.getPropertyName(), ie);
    } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
        throw new RuntimeException("Cannot access PropertyType for property " + "'" + col.getPropertyName()
                + "' " + " on an instance of '" + element.getClass().getName() + "'.", ex);
    }
    return col;
}

From source file:org.kuali.kfs.module.ar.businessobject.lookup.CustomerInvoiceWriteoffLookupResultLookupableHelperServiceImpl.java

/**
 * @param element//  ww  w  . j a  va  2  s  . c om
 * @param attributeName
 * @return Column
 *
 * KRAD Conversion: setup up the results column in the display results set.
 *
 * No use of data dictionary.
 */
protected Column setupResultsColumn(BusinessObject element, String attributeName,
        BusinessObjectRestrictions businessObjectRestrictions) {
    Column col = new Column();

    col.setPropertyName(attributeName);

    String columnTitle = getDataDictionaryService().getAttributeLabel(element.getClass(), attributeName);
    if (StringUtils.isBlank(columnTitle)) {
        columnTitle = getDataDictionaryService().getCollectionLabel(element.getClass(), attributeName);
    }
    col.setColumnTitle(columnTitle);
    col.setMaxLength(getDataDictionaryService().getAttributeMaxLength(element.getClass(), attributeName));

    try {
        Class formatterClass = getDataDictionaryService().getAttributeFormatter(element.getClass(),
                attributeName);
        Formatter formatter = null;
        if (formatterClass != null) {
            formatter = (Formatter) formatterClass.newInstance();
            col.setFormatter(formatter);
        }

        // pick off result column from result list, do formatting
        String propValue = KFSConstants.EMPTY_STRING;
        Object prop = ObjectUtils.getPropertyValue(element, attributeName);

        // set comparator and formatter based on property type
        Class propClass = null;
        PropertyDescriptor propDescriptor = PropertyUtils.getPropertyDescriptor(element, col.getPropertyName());
        if (propDescriptor != null) {
            propClass = propDescriptor.getPropertyType();
        }

        // formatters
        if (prop != null) {
            propValue = getContractsGrantsReportHelperService().formatByType(prop, formatter);
        }

        // comparator
        col.setComparator(CellComparatorHelper.getAppropriateComparatorForPropertyClass(propClass));
        col.setValueComparator(CellComparatorHelper.getAppropriateValueComparatorForPropertyClass(propClass));
        propValue = super.maskValueIfNecessary(element.getClass(), col.getPropertyName(), propValue,
                businessObjectRestrictions);
        col.setPropertyValue(propValue);

        if (StringUtils.isNotBlank(propValue)) {
            col.setColumnAnchor(getInquiryUrl(element, col.getPropertyName()));
        }
    } catch (InstantiationException ie) {
        throw new RuntimeException(
                "Unable to get new instance of formatter class for property " + col.getPropertyName(), ie);
    } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
        throw new RuntimeException("Cannot access PropertyType for property " + "'" + col.getPropertyName()
                + "' " + " on an instance of '" + element.getClass().getName() + "'.", ex);
    }
    return col;
}

From source file:org.kuali.kfs.module.ar.businessobject.lookup.GenerateDunningLettersLookupableHelperServiceImpl.java

/**
 * @param element//from  ww w  .j a  v a2s  .co  m
 * @param attributeName
 * @return Column
 */
protected Column setupResultsColumn(BusinessObject element, String attributeName,
        BusinessObjectRestrictions businessObjectRestrictions) {
    Column col = new Column();

    col.setPropertyName(attributeName);

    String columnTitle = getDataDictionaryService().getAttributeLabel(element.getClass(), attributeName);
    if (StringUtils.isBlank(columnTitle)) {
        columnTitle = getDataDictionaryService().getCollectionLabel(element.getClass(), attributeName);
    }
    col.setColumnTitle(columnTitle);
    col.setMaxLength(getDataDictionaryService().getAttributeMaxLength(element.getClass(), attributeName));

    try {
        Class formatterClass = getDataDictionaryService().getAttributeFormatter(element.getClass(),
                attributeName);
        Formatter formatter = null;
        if (ObjectUtils.isNotNull(formatterClass)) {
            formatter = (Formatter) formatterClass.newInstance();
            col.setFormatter(formatter);
        }

        // Pick off result column from result list, do formatting
        String propValue = KFSConstants.EMPTY_STRING;
        Object prop = ObjectUtils.getPropertyValue(element, attributeName);

        // Set comparator and formatter based on property type
        Class propClass = null;
        PropertyDescriptor propDescriptor = PropertyUtils.getPropertyDescriptor(element, col.getPropertyName());
        if (ObjectUtils.isNotNull(propDescriptor)) {
            propClass = propDescriptor.getPropertyType();
        }

        // Formatters
        if (ObjectUtils.isNotNull(prop)) {
            propValue = getContractsGrantsReportHelperService().formatByType(prop, formatter);
        }

        // Comparator
        col.setComparator(CellComparatorHelper.getAppropriateComparatorForPropertyClass(propClass));
        col.setValueComparator(CellComparatorHelper.getAppropriateValueComparatorForPropertyClass(propClass));
        propValue = super.maskValueIfNecessary(element.getClass(), col.getPropertyName(), propValue,
                businessObjectRestrictions);
        col.setPropertyValue(propValue);

        if (StringUtils.isNotBlank(propValue)) {
            col.setColumnAnchor(getInquiryUrl(element, col.getPropertyName()));
        }
    } catch (InstantiationException ie) {
        throw new RuntimeException(
                "Unable to get new instance of formatter class for property " + col.getPropertyName(), ie);
    } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
        throw new RuntimeException("Cannot access PropertyType for property " + "'" + col.getPropertyName()
                + "' " + " on an instance of '" + element.getClass().getName() + "'.", ex);
    }
    return col;
}

From source file:org.kuali.kfs.module.bc.document.validation.impl.BudgetConstructionDocumentRules.java

/**
 * Validates a single primitive in a BO/*from  ww w.j av  a2  s. c o  m*/
 *
 * @param object
 * @param attributeName
 * @param errorPrefix
 * @param validateRequired
 */
protected void validatePrimitiveFromDescriptor(Object object, String attributeName, String errorPrefix,
        boolean validateRequired) {

    try {
        PropertyDescriptor attributeDescriptor = PropertyUtils.getPropertyDescriptor(object, attributeName);
        validatePrimitiveFromDescriptor(object.getClass().getName(), object, attributeDescriptor, "", true);
    } catch (NoSuchMethodException e) {
        throw new InfrastructureException(
                "unable to find propertyDescriptor for property '" + attributeName + "'", e);
    } catch (IllegalAccessException e) {
        throw new InfrastructureException(
                "unable to access propertyDescriptor for property '" + attributeName + "'", e);
    } catch (InvocationTargetException e) {
        throw new InfrastructureException("unable to invoke methods for property '" + attributeName + "'", e);
    }
}

From source file:org.kuali.kfs.module.ld.businessobject.lookup.LedgerBalanceForExpenseTransferLookupableHelperServiceImpl.java

/**
 * @param element/*w w  w.j a  va  2 s  .c om*/
 * @param attributeName
 * @return Column
 *
 * KRAD Conversion: Performs customization of the results columns.
 *
 * Uses data dictionary to get column properties.
 */
protected Column setupResultsColumn(BusinessObject element, String attributeName,
        BusinessObjectRestrictions businessObjectRestrictions) {
    Column col = new Column();

    col.setPropertyName(attributeName);

    String columnTitle = getDataDictionaryService().getAttributeLabel(getBusinessObjectClass(), attributeName);
    if (StringUtils.isBlank(columnTitle)) {
        columnTitle = getDataDictionaryService().getCollectionLabel(getBusinessObjectClass(), attributeName);
    }
    col.setColumnTitle(columnTitle);
    col.setMaxLength(getDataDictionaryService().getAttributeMaxLength(getBusinessObjectClass(), attributeName));

    Class formatterClass = getDataDictionaryService().getAttributeFormatter(getBusinessObjectClass(),
            attributeName);
    Formatter formatter = null;
    if (formatterClass != null) {
        try {
            formatter = (Formatter) formatterClass.newInstance();
            col.setFormatter(formatter);
        } catch (InstantiationException e) {
            LOG.error("Unable to get new instance of formatter class: " + formatterClass.getName());
            throw new RuntimeException(
                    "Unable to get new instance of formatter class: " + formatterClass.getName());
        } catch (IllegalAccessException e) {
            LOG.error("Unable to get new instance of formatter class: " + formatterClass.getName());
            throw new RuntimeException(
                    "Unable to get new instance of formatter class: " + formatterClass.getName());
        }
    }

    // pick off result column from result list, do formatting
    String propValue = KFSConstants.EMPTY_STRING;
    Object prop = ObjectUtils.getPropertyValue(element, attributeName);

    // set comparator and formatter based on property type
    Class propClass = null;
    try {
        PropertyDescriptor propDescriptor = PropertyUtils.getPropertyDescriptor(element, col.getPropertyName());
        if (propDescriptor != null) {
            propClass = propDescriptor.getPropertyType();
        }
    } catch (Exception e) {
        throw new RuntimeException("Cannot access PropertyType for property " + "'" + col.getPropertyName()
                + "' " + " on an instance of '" + element.getClass().getName() + "'.", e);
    }

    // formatters
    if (prop != null) {
        // for Booleans, always use BooleanFormatter
        if (prop instanceof Boolean) {
            formatter = new BooleanFormatter();
        }

        if (formatter != null) {
            propValue = (String) formatter.format(prop);
        } else {
            propValue = prop.toString();
        }
    }

    // comparator
    col.setComparator(CellComparatorHelper.getAppropriateComparatorForPropertyClass(propClass));
    col.setValueComparator(CellComparatorHelper.getAppropriateValueComparatorForPropertyClass(propClass));

    propValue = super.maskValueIfNecessary(element.getClass(), col.getPropertyName(), propValue,
            businessObjectRestrictions);
    col.setPropertyValue(propValue);

    if (StringUtils.isNotBlank(propValue)) {
        col.setColumnAnchor(getInquiryUrl(element, col.getPropertyName()));
    }
    return col;
}

From source file:org.kuali.kfs.sec.businessobject.lookup.AccessSecurityBalanceLookupableHelperServiceImpl.java

/**
 * @param element/*from   w ww  . j a  v a  2 s  .c o m*/
 * @param attributeName
 * @return Column
 */
protected Column setupResultsColumn(BusinessObject element, String attributeName,
        BusinessObjectRestrictions businessObjectRestrictions) {
    Column col = new Column();

    col.setPropertyName(attributeName);

    String columnTitle = getDataDictionaryService().getAttributeLabel(getBusinessObjectClass(), attributeName);
    if (StringUtils.isBlank(columnTitle)) {
        columnTitle = getDataDictionaryService().getCollectionLabel(getBusinessObjectClass(), attributeName);
    }
    col.setColumnTitle(columnTitle);
    col.setMaxLength(getDataDictionaryService().getAttributeMaxLength(getBusinessObjectClass(), attributeName));

    Class formatterClass = getDataDictionaryService().getAttributeFormatter(getBusinessObjectClass(),
            attributeName);
    Formatter formatter = null;
    if (formatterClass != null) {
        try {
            formatter = (Formatter) formatterClass.newInstance();
            col.setFormatter(formatter);
        } catch (InstantiationException e) {
            throw new RuntimeException(
                    "Unable to get new instance of formatter class: " + formatterClass.getName());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(
                    "Unable to get new instance of formatter class: " + formatterClass.getName());
        }
    }

    // pick off result column from result list, do formatting
    String propValue = KFSConstants.EMPTY_STRING;
    Object prop = ObjectUtils.getPropertyValue(element, attributeName);

    // set comparator and formatter based on property type
    Class propClass = null;
    try {
        PropertyDescriptor propDescriptor = PropertyUtils.getPropertyDescriptor(element, col.getPropertyName());
        if (propDescriptor != null) {
            propClass = propDescriptor.getPropertyType();
        }
    } catch (Exception e) {
        throw new RuntimeException("Cannot access PropertyType for property " + "'" + col.getPropertyName()
                + "' " + " on an instance of '" + element.getClass().getName() + "'.", e);
    }

    // formatters
    if (prop != null) {
        // for Booleans, always use BooleanFormatter
        if (prop instanceof Boolean) {
            formatter = new BooleanFormatter();
        }

        if (formatter != null) {
            propValue = (String) formatter.format(prop);
        } else {
            propValue = prop.toString();
        }
    }

    // comparator
    col.setComparator(CellComparatorHelper.getAppropriateComparatorForPropertyClass(propClass));
    col.setValueComparator(CellComparatorHelper.getAppropriateValueComparatorForPropertyClass(propClass));

    propValue = maskValueIfNecessary(element.getClass(), col.getPropertyName(), propValue,
            businessObjectRestrictions);
    col.setPropertyValue(propValue);

    if (StringUtils.isNotBlank(propValue)) {
        col.setColumnAnchor(getInquiryUrl(element, col.getPropertyName()));
    }
    return col;
}

From source file:org.kuali.kpme.core.krms.KpmeKrmsFactBuilderServiceHelper.java

/**
 *
 * This method gets all terms from the <code>factsObject</code>and add it to the KRMS FactsBuilder
 * @param factsBuilder/*w w w  .ja  v  a2 s .  co  m*/
 * @param factsObject
 * @param contextId
 * @param factTermNS
 */
public void addObjectMembersAsFacts(Facts.Builder factsBuilder, Object factsObject, String contextId,
        String factTermNS) {
    TermRepositoryService termRepositoryService = HrServiceLocator.getService("termRepositoryService");
    //TermSpecificationDefinition termSpec = termRepositoryService.getTermSpecificationByNameAndNamespace("KPME_Term_SPEC", "KPME_NMSPC");
    //List<TermSpecificationDefinition> termSpecs = Collections.singletonList(termSpec);
    List<TermSpecificationDefinition> termSpecs = (List<TermSpecificationDefinition>) termRepositoryService
            .findAllTermSpecificationsByContextId(contextId);
    for (TermSpecificationDefinition termSpecificationDefinition : termSpecs) {

        if (isPropertyType(termSpecificationDefinition)) {
            String termNS = termSpecificationDefinition.getNamespace();
            if (termNS.equals(factTermNS)) {
                String factKey = termSpecificationDefinition.getName();
                if (factsObject != null) {
                    Class factsClazz = factsObject.getClass();
                    PropertyDescriptor propDescriptor = null;
                    try {
                        propDescriptor = PropertyUtils.getPropertyDescriptor(factsObject, factKey);
                        if (propDescriptor != null) {
                            Object propertyValue = null;
                            Method readMethod = propDescriptor.getReadMethod();
                            if (readMethod != null) {
                                propertyValue = propDescriptor.getReadMethod().invoke(factsObject);
                            }
                            factsBuilder.addFact(factKey, propertyValue);
                        }
                    } catch (IllegalArgumentException e) {
                        LOG.error("KRMS Fact for " + factKey + " has not been added to fact builder", e);
                    } catch (IllegalAccessException e) {
                        LOG.error("KRMS Fact for " + factKey + " has not been added to fact builder", e);
                    } catch (InvocationTargetException e) {
                        LOG.error("KRMS Fact for " + factKey + " has not been added to fact builder", e);
                    } catch (NoSuchMethodException e) {
                        LOG.error("KRMS Fact for " + factKey + " has not been added to fact builder", e);
                    }
                } else {
                    factsBuilder.addFact(factKey, null);
                }
            }
        }
    }
}

From source file:org.kuali.kra.bo.KraPersistableBusinessObjectBase.java

/**
 * {@inheritDoc}//from w  w  w.  j  ava 2 s.  c  o m
 * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#afterInsert(org.apache.ojb.broker.PersistenceBroker)
 */
@Override
@SuppressWarnings("unchecked")
public void afterInsert(PersistenceBroker persistenceBroker) throws PersistenceBrokerException {
    if (temporaryExtension != null) {
        List<String> fieldNames = getPersistenceStructureService().listPrimaryKeyFieldNames(getClass());
        try {
            for (String fieldName : fieldNames) {
                try {
                    Method thisGetter = PropertyUtils
                            .getReadMethod(PropertyUtils.getPropertyDescriptor(this, fieldName));
                    Method extensionSetter = PropertyUtils
                            .getWriteMethod(PropertyUtils.getPropertyDescriptor(temporaryExtension, fieldName));
                    extensionSetter.invoke(temporaryExtension, thisGetter.invoke(this));
                } catch (NoSuchMethodException nsme) {
                    throw new PersistenceBrokerException(
                            "Could not find accessor for " + fieldName + " in an extension object", nsme);
                } catch (InvocationTargetException ite) {
                    throw new PersistenceBrokerException(
                            "Could not invoke accessor for " + fieldName + " on an extension object", ite);
                } catch (IllegalAccessException iae) {
                    throw new PersistenceBrokerException(
                            "Illegal access when invoking " + fieldName + " accessor on an extension object",
                            iae);
                }
            }
        } finally {
            extension = temporaryExtension;
            temporaryExtension = null;
        }
    }
}

From source file:org.kuali.kra.krms.service.impl.KcKrmsFactBuilderServiceHelper.java

/**
 * /*from  w  ww .j  av a 2 s.c  o m*/
 * This method gets all terms from the <code>factsObject</code>and add it to the KRMS FactsBuilder 
 * @param factsBuilder
 * @param factsObject
 * @param contextId
 * @param factTermNameSpace
 */
public void addObjectMembersAsFacts(Facts.Builder factsBuilder, Object factsObject, String contextId,
        String factTermNS) {
    TermRepositoryService termRepositoryService = KraServiceLocator.getService("termRepositoryService");
    List<TermSpecificationDefinition> termSpecs = (List<TermSpecificationDefinition>) termRepositoryService
            .findAllTermSpecificationsByContextId(contextId);
    for (TermSpecificationDefinition termSpecificationDefinition : termSpecs) {

        if (isPropertyType(termSpecificationDefinition)) {
            String termNS = termSpecificationDefinition.getNamespace();
            if (termNS.equals(factTermNS)) {
                String factKey = termSpecificationDefinition.getName();
                if (factsObject != null) {
                    Class factsClazz = factsObject.getClass();
                    PropertyDescriptor propDescriptor = null;
                    try {
                        propDescriptor = PropertyUtils.getPropertyDescriptor(factsObject, factKey);
                        if (propDescriptor != null) {
                            Object propertyValue = null;
                            Method readMethod = propDescriptor.getReadMethod();
                            if (readMethod != null) {
                                propertyValue = propDescriptor.getReadMethod().invoke(factsObject);
                            }
                            if (propertyValue != null
                                    && propertyValue.getClass().isAssignableFrom(BudgetDecimal.class)) {
                                propertyValue = ((BudgetDecimal) propertyValue).bigDecimalValue();
                            }
                            factsBuilder.addFact(factKey, propertyValue);
                        }
                    } catch (IllegalArgumentException e) {
                        LOG.error("KRMS Fact for " + factKey + " has not been added to fact builder", e);
                    } catch (IllegalAccessException e) {
                        LOG.error("KRMS Fact for " + factKey + " has not been added to fact builder", e);
                    } catch (InvocationTargetException e) {
                        LOG.error("KRMS Fact for " + factKey + " has not been added to fact builder", e);
                    } catch (NoSuchMethodException e) {
                        LOG.error("KRMS Fact for " + factKey + " has not been added to fact builder", e);
                    }
                } else {
                    factsBuilder.addFact(factKey, null);
                }
            }
        }
    }
}

From source file:org.kuali.ole.sec.businessobject.lookup.AccessSecurityBalanceLookupableHelperServiceImpl.java

/**
 * @param element//from www  .ja  v  a  2  s.  co m
 * @param attributeName
 * @return Column
 */
protected Column setupResultsColumn(BusinessObject element, String attributeName,
        BusinessObjectRestrictions businessObjectRestrictions) {
    Column col = new Column();

    col.setPropertyName(attributeName);

    String columnTitle = getDataDictionaryService().getAttributeLabel(getBusinessObjectClass(), attributeName);
    if (StringUtils.isBlank(columnTitle)) {
        columnTitle = getDataDictionaryService().getCollectionLabel(getBusinessObjectClass(), attributeName);
    }
    col.setColumnTitle(columnTitle);
    col.setMaxLength(getDataDictionaryService().getAttributeMaxLength(getBusinessObjectClass(), attributeName));

    Class formatterClass = getDataDictionaryService().getAttributeFormatter(getBusinessObjectClass(),
            attributeName);
    Formatter formatter = null;
    if (formatterClass != null) {
        try {
            formatter = (Formatter) formatterClass.newInstance();
            col.setFormatter(formatter);
        } catch (InstantiationException e) {
            throw new RuntimeException(
                    "Unable to get new instance of formatter class: " + formatterClass.getName());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(
                    "Unable to get new instance of formatter class: " + formatterClass.getName());
        }
    }

    // pick off result column from result list, do formatting
    String propValue = OLEConstants.EMPTY_STRING;
    Object prop = ObjectUtils.getPropertyValue(element, attributeName);

    // set comparator and formatter based on property type
    Class propClass = null;
    try {
        PropertyDescriptor propDescriptor = PropertyUtils.getPropertyDescriptor(element, col.getPropertyName());
        if (propDescriptor != null) {
            propClass = propDescriptor.getPropertyType();
        }
    } catch (Exception e) {
        throw new RuntimeException("Cannot access PropertyType for property " + "'" + col.getPropertyName()
                + "' " + " on an instance of '" + element.getClass().getName() + "'.", e);
    }

    // formatters
    if (prop != null) {
        // for Booleans, always use BooleanFormatter
        if (prop instanceof Boolean) {
            formatter = new BooleanFormatter();
        }

        if (formatter != null) {
            propValue = (String) formatter.format(prop);
        } else {
            propValue = prop.toString();
        }
    }

    // comparator
    col.setComparator(CellComparatorHelper.getAppropriateComparatorForPropertyClass(propClass));
    col.setValueComparator(CellComparatorHelper.getAppropriateValueComparatorForPropertyClass(propClass));

    propValue = maskValueIfNecessary(element.getClass(), col.getPropertyName(), propValue,
            businessObjectRestrictions);
    col.setPropertyValue(propValue);

    if (StringUtils.isNotBlank(propValue)) {
        col.setColumnAnchor(getInquiryUrl(element, col.getPropertyName()));
    }
    return col;
}