Class Bean

    • Constructor Detail

      • Bean

        public Bean()
    • Method Detail

      • addPropertyChangeListener

        public void addPropertyChangeListener​(Property<?,​?> property,
                                              PropertyChangeListener listener)
        Adds a specific property change listener
      • addPropertyChangeListener

        public void addPropertyChangeListener​(PropertyChangeListener listener)
        Adds a global property change listener
      • attributeNames

        public Set<String> attributeNames()
        Returns the names of contextual attributes
      • backup

        public void backup()
        Marks this bean to backup the current values, so, if they are replaced, the original values can be restored
      • className

        public abstract String className()
      • clearAttributes

        public void clearAttributes()
        Removes all attributes
      • copyPropertiesTo

        public void copyPropertiesTo​(Bean destination)
        Copies all the properties from this bean into the given destination bean
      • copyPropertiesTo

        public void copyPropertiesTo​(Bean destination,
                                     List<Property<?,​?>> propertiesToSkip)
        Copies all the properties from this bean into the given destination bean skipping the given properties
      • copyPropertiesTo

        public void copyPropertiesTo​(Bean destination,
                                     Property<?,​?>... propertiesToSkip)
      • getAttribute

        public Object getAttribute​(String name)
        Gets a contextual attribute, or null if none is found
      • initDataAccessor

        public void initDataAccessor​(BeanDataAccessor dataAccessor)
      • properties

        public final List<Property<?,​?>> properties()
        Returns a list with all properties
      • property

        public <P extends Property<T,​DTO>,​T,​DTO extends Bean> P property​(String name)
        Returns a property descriptor by name
      • propertyMap

        public Map<String,​Property<?,​?>> propertyMap()
        Returns a map with all properties. If the bean doesn't have any property then an empty map is returned.
      • removeAttribute

        public boolean removeAttribute​(String name)
        Removes the attribute with the given name
      • removePropertyChangeListener

        public void removePropertyChangeListener​(Property<?,​?> property,
                                                 PropertyChangeListener listener)
        Removes a specific property change listener
      • removePropertyChangeListener

        public void removePropertyChangeListener​(PropertyChangeListener listener)
        Removes a global property change listener
      • restore

        public void restore()
        Restores the currently backed up values
      • set

        public final <T> T set​(Property<T,​?> property,
                               T value)
        Sets the value for the given property
      • set

        public final <T> T set​(Property<T,​?> property,
                               T value,
                               boolean notifyListeners)
        Sets the value for the given property, optionally notifying listeners
      • setAttribute

        public void setAttribute​(String name,
                                 Object value)
        Sets a contextual attribute
      • setWithPropagationId

        public final <T> T setWithPropagationId​(Property<T,​?> property,
                                                T value,
                                                Object propagationId)
        Sets the value for the given property, notifying listeners with a custom propagation id
      • values

        public Map<String,​Object> values()
        Returns all bean values in a Map. Null values are not included.
      • doGetProperties

        protected List<Property<?,​?>> doGetProperties()
      • firePropertyChange

        protected void firePropertyChange​(Property<?,​?> property,
                                          Object oldValue,
                                          Object newValue)
        Fires a property change event