{
final BeanUtility utility = new BeanUtility(expression);
final ExpressionPropertyMetaData[] propertyDescriptions = expressionMetaData.getPropertyDescriptions();
for (int x = 0; x < propertyDescriptions.length; x++)
{
final ExpressionPropertyMetaData metaData = propertyDescriptions[x];
final Object o = utility.getProperty(metaData.getName());
if (o instanceof String == false)
{
continue;
}
final String fmtString = (String) o;
final String role = metaData.getPropertyRole();
try
{
if ("NumberFormat".equals(role))//NON-NLS
{
final DecimalFormat fmt = new DecimalFormat(String.valueOf(o));
}
else if ("DateFormat".equals(role))//NON-NLS
{
//noinspection SimpleDateFormatWithoutLocale
final DateFormat fmt = new SimpleDateFormat(String.valueOf(o));
}
else if ("Message".equals(role))//NON-NLS
{
final MessageFormatSupport support = new MessageFormatSupport();
support.setFormatString(fmtString);
}
}
catch (Exception e)
{
final AttributeMetaData attrMetaData =
element.getMetaData().getAttributeDescription(attributeNamespace, attributeName);
if (attrMetaData == null)
{
resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
Messages.getString("InvalidFormatInspection.AttributeExpressionInvalidFormatNoMetaData",
element.getName(), attributeNamespace, attributeName, fmtString, metaData.getDisplayName(Locale.getDefault())),
new AttributeExpressionPropertyLocationInfo(element, attributeNamespace, attributeName, metaData.getName())));
}
else
{
resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
Messages.getString("InvalidFormatInspection.AttributeExpressionInvalidFormat",
element.getName(), attrMetaData.getDisplayName(Locale.getDefault()), fmtString, metaData.getDisplayName(Locale.getDefault())),
new AttributeExpressionPropertyLocationInfo(element, attributeNamespace, attributeName, metaData.getName())));
}
}
}