本文整理汇总了Java中org.apache.commons.beanutils.BeanToPropertyValueTransformer类的典型用法代码示例。如果您正苦于以下问题:Java BeanToPropertyValueTransformer类的具体用法?Java BeanToPropertyValueTransformer怎么用?Java BeanToPropertyValueTransformer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BeanToPropertyValueTransformer类属于org.apache.commons.beanutils包,在下文中一共展示了BeanToPropertyValueTransformer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deepSort
import org.apache.commons.beanutils.BeanToPropertyValueTransformer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void deepSort(DefaultMutableTreeNode parent,
TreeObjectSortBy sortBy, SortOrder order) {
Enumeration<DefaultMutableTreeNode> treeObjectNodes = parent.children();
List<DefaultMutableTreeNode> treeNodes = EnumerationUtils
.toList(treeObjectNodes);
BeanToPropertyValueTransformer sortProperty = getSortByTransformer(sortBy);
Comparator<DefaultMutableTreeNode> comparator = new TransformingComparator(
sortProperty);
if (SortOrder.DESC.equals(order)) {
comparator = new ReverseComparator<DefaultMutableTreeNode>(
comparator);
}
Collections.sort(treeNodes, comparator);
parent.removeAllChildren();
for (DefaultMutableTreeNode childNode : treeNodes) {
parent.add(childNode);
deepSort(childNode, sortBy, order);
}
}
示例2: getSortByTransformer
import org.apache.commons.beanutils.BeanToPropertyValueTransformer; //导入依赖的package包/类
private BeanToPropertyValueTransformer getSortByTransformer(
TreeObjectSortBy sortBy) {
String sortProperty = null;
switch (sortBy) {
case NAME:
sortProperty = "userObject.path.pathname";
break;
case SIZE:
sortProperty = "userObject.size";
break;
default:
sortProperty = "userObject";
break;
}
BeanToPropertyValueTransformer beanValueTransformer = new BeanToPropertyValueTransformer(
sortProperty);
return beanValueTransformer;
}
示例3: doSliderRange
import org.apache.commons.beanutils.BeanToPropertyValueTransformer; //导入依赖的package包/类
private void doSliderRange(JspWriter out) throws JspException, IOException {
List<Product> products = ((SearchFilterTag) getParent()).getProducts();
Money min = null;
Money max = null;
BeanToPropertyValueTransformer valueTransformer = new BeanToPropertyValueTransformer(property, true);
for (Product product : products) {
Money propertyObject = (Money) valueTransformer.transform(product);
if (propertyObject == null) {
min = new Money(0D);
max = new Money(0D);
} else {
min = propertyObject.min(min);
max = propertyObject.max(max);
}
}
String propertyCss = property.replaceAll("[.\\[\\]]", "_");
out.println("<div id='searchFilter-"+propertyCss+"'></div>");
out.println("Range:");
out.println("<input type=\"text\" id=\"min-" + propertyCss + "\" name='min-" + property + "' value='"+min.getCurrency().getSymbol()+min.getAmount().toPlainString()+"'/> - ");
out.println("<input type=\"text\" id=\"max-" + propertyCss + "\" name='max-" + property + "' value='"+max.getCurrency().getSymbol()+max.getAmount().toPlainString()+"'/> <br/>");
out.println(" <script type=\"text/javascript\">\r\n" +
" $(function() {\r\n" +
" $(\"#searchFilter-" + propertyCss + "\").slider({\r\n" +
" range: true,\r\n" +
" min: "+ min.getAmount().toPlainString() +", max: "+ max.getAmount().toPlainString() + "," +
" values: ["+ min.getAmount().toPlainString() +","+ max.getAmount().toPlainString() +"]," +
" slide: function(event, ui) {\r\n" +
" $(\"#min-" + propertyCss + "\").val('" + min.getCurrency().getSymbol() + "' + ui.values[0] );\r\n" +
" $(\"#max-" + propertyCss + "\").val('" + max.getCurrency().getSymbol() + "' + ui.values[1]);\r\n" +
" }\r\n" +
" });\r\n" +
" });\r\n" +
" $('#searchFilter-"+propertyCss+"').bind('slidechange', updateSearchFilterResults); \r\n" +
" </script>");
}
示例4: addProjections
import org.apache.commons.beanutils.BeanToPropertyValueTransformer; //导入依赖的package包/类
/**
* JAVADOC Method Level Comments
*
* @param subjectType
* JAVADOC.
* @param search
* JAVADOC.
* @param projections
* JAVADOC.
* @see org.cucina.meringue.search.SearchBeanFactory#addProjections(java.lang
* .String, org.cucina.meringue.query.SearchBean, java.lang.String[])
*/
@SuppressWarnings("unchecked")
@Override
public void addProjections(String subjectType, SearchBean search,
Collection<String> projections, Class<?>... projectionGroup) {
Assert.notNull(search, "search is required!");
Assert.hasText(subjectType, "subjectType is required!");
Assert.notEmpty(projections, "projections is required!");
addProjections(subjectType, search, projectionGroup);
ArrayList<Projection> orderedProjections = new ArrayList<Projection>();
for (String requestedProjection : projections) {
for (Iterator<Projection> iter = search.getProjections().iterator(); iter.hasNext();) {
Projection projection = iter.next();
if (requestedProjection.equals(projection.getAlias())) {
orderedProjections.add(projection);
iter.remove();
break;
}
}
}
search.setProjections(orderedProjections);
Collection<String> unresolved = CollectionUtils.subtract(projections,
CollectionUtils.collect(search.getProjections(),
new BeanToPropertyValueTransformer("alias")));
if (LOG.isDebugEnabled()) {
LOG.debug("The following requested projections " + unresolved + " could not be found");
}
Assert.notEmpty(search.getProjections(), "No projections could be added!");
}