/** * Creates a new binder that uses reflection based on the provided bean type * to resolve bean properties. * * @param beanType * the bean type to use, not <code>null</code> */ public Binder(Class<BEAN> beanType) { this(BeanPropertySet.get(beanType)); }
/** * Creates a new grid that uses custom data communicator and provided bean * type * * It uses reflection of the provided bean type to automatically set up an * initial set of columns. All columns will be configured using the same * {@link Object#toString()} renderer that is used by * {@link #addColumn(ValueProvider)}. * * @param beanType * the bean type to use, not <code>null</code> * @param dataCommunicator * the data communicator to use, not<code>null</code> * @since 8.0.7 */ protected Grid(Class<T> beanType, DataCommunicator<T> dataCommunicator) { this(BeanPropertySet.get(beanType), dataCommunicator); this.beanType = beanType; }
private Object readResolve() throws IOException { /* * When this instance is deserialized, it will be replaced with a * property definition for the corresponding bean type and property * name. */ return get(beanType).getProperty(propertyName) .orElseThrow(() -> new IOException( beanType + " no longer has a property named " + propertyName)); } }
private Object readResolve() { /* * When this instance is deserialized, it will be replaced with a * property set for the corresponding bean type and property name. */ return get(instanceKey.type, instanceKey.checkNestedDefinitions, new PropertyFilterDefinition(instanceKey.depth, instanceKey.ignorePackageNames)); } }
/** * Creates a new binder that uses reflection based on the provided bean type * to resolve bean properties. * * @param beanType * the bean type to use, not {@code null} * @param scanNestedDefinitions * if {@code true}, scan for nested property definitions as well * @since 8.2 */ public Binder(Class<BEAN> beanType, boolean scanNestedDefinitions) { this(BeanPropertySet.get(beanType, scanNestedDefinitions, PropertyFilterDefinition.getDefaultFilter())); }
/** * Sets the bean type to use for property mapping. * <p> * This method is responsible also for setting or updating the property set * so that it matches the given bean type. * <p> * Protected mostly for Designer needs, typically should not be overridden * or even called. * * @param beanType * the bean type class * * @since 8.0.3 */ protected void setBeanType(Class<T> beanType) { this.beanType = beanType; setPropertySet(BeanPropertySet.get(beanType)); }
public TableDefinition( final Class<T> entity, final String entityViewName) { this.entity = entity; this.propertySet = BeanPropertySet.get(entity); this.entityViewName = entityViewName; }
/** * Constructor. * @param beanType Bean type (not null) */ public DefaultBeanListingBuilder(Class<T> beanType) { super(new DefaultBeanListing<>(beanType), String.class); this.beanType = beanType; // read bean property names getInstance().getPropertyDefinitions().forEach(p -> { dataSourceBuilder.withProperty(p.getName(), p.getType(), false); dataSourceBuilder.propertyId(p.getName(), p.getName()); if (p.isReadOnly()) { dataSourceBuilder.readOnly(p.getName(), true); } if (p.getBeanProperty().isPresent()) { dataSourceBuilder.sortable(p.getName(), true); } }); PropertySet<T> propertySet = BeanPropertySet.get(beanType); propertySet.getProperties().forEach(p -> { dataSourceBuilder.withProperty(p.getName(), p.getType()); }); }