001 package org.tynamo.util;
002
003 import ognl.Ognl;
004 import ognl.OgnlException;
005 import org.apache.tapestry5.beaneditor.BeanModel;
006 import org.tynamo.descriptor.TynamoClassDescriptor;
007
008 import java.util.List;
009
010 /**
011 * Utilities used to modify a {@link org.apache.tapestry5.beaneditor.BeanModel}.
012 */
013 public final class BeanModelUtils
014 {
015
016 /**
017 * Removes properties from the bean model.
018 *
019 * @param model to modifiy
020 * @param classDescriptor
021 */
022 public static void exclude(BeanModel model, TynamoClassDescriptor classDescriptor)
023 {
024 try
025 {
026 List<String> nameList = (List<String>) Ognl
027 .getValue("propertyDescriptors.{? identifier or !summary or hidden or collection}.{name}",
028 classDescriptor);
029
030 model.exclude((String[]) nameList.toArray(new String[nameList.size()]));
031
032 } catch (OgnlException e)
033 {
034 }
035 }
036
037
038 }