/** * <p> * Creates a new instance of <code>BeanItem</code> and adds all properties * of a Java Bean to it. The properties are identified by their respective * bean names. * </p> * * <p> * Note : This version only supports introspectable bean properties and * their getter and setter methods. Stand-alone <code>is</code> and * <code>are</code> methods are not supported. * </p> * * @since 7.4 * * @param bean * the Java Bean to copy properties from. * @param beanClass * class of the {@code bean} * */ public BeanItem(BT bean, Class<BT> beanClass) { this(bean, getPropertyDescriptors(beanClass)); }
/** * Constructs a {@code AbstractBeanContainer} for beans of the given type. * * @param type * the type of the beans that will be added to the container. * @throws IllegalArgumentException * If {@code type} is null */ protected AbstractBeanContainer(Class<? super BEANTYPE> type) { if (type == null) { throw new IllegalArgumentException( "The bean type passed to AbstractBeanContainer must not be null"); } this.type = type; model = BeanItem.getPropertyDescriptors((Class<BEANTYPE>) type); }
/** * Expands nested bean properties by replacing a top-level property with * some or all of its sub-properties. The expansion is not recursive. * * @param propertyId * property id for the property whose sub-properties are to be * expanded, * @param subPropertyIds * sub-properties to expand, all sub-properties are expanded if * not specified */ public void expandProperty(String propertyId, String... subPropertyIds) { Set<String> subPropertySet = new HashSet<String>( Arrays.asList(subPropertyIds)); if (0 == subPropertyIds.length) { // Enumerate all sub-properties Class<?> propertyType = getItemProperty(propertyId).getType(); Map<String, ?> pds = getPropertyDescriptors(propertyType); subPropertySet.addAll(pds.keySet()); } for (String subproperty : subPropertySet) { String qualifiedPropertyId = propertyId + "." + subproperty; addNestedProperty(qualifiedPropertyId); } removeItemProperty(propertyId); }
LinkedHashMap<String, VaadinPropertyDescriptor<BT>> pds = getPropertyDescriptors( (Class<BT>) bean.getClass());
Class<?> propertyType = getType(propertyId); LinkedHashMap<String, VaadinPropertyDescriptor<Object>> pds = BeanItem .getPropertyDescriptors((Class<Object>) propertyType); for (String subPropertyId : pds.keySet()) { String qualifiedPropertyId = propertyId + "." + subPropertyId;