Interface Bean

  • All Known Subinterfaces:
    DynamicBean, ImmutableBean
    All Known Implementing Classes:
    BasicBean, DirectBean, FlexiBean, MapBean

    public interface Bean
    A bean consisting of a set of properties.

    The implementation may be any class, but is typically a standard JavaBean with get/set methods. Alternate implementations might store the properties in another data structure such as a map.

    • Method Detail

      • metaBean

        MetaBean metaBean()
        Gets the meta-bean representing the parts of the bean that are common across all instances, such as the set of meta-properties.

        The meta-bean can be thought of as the equivalent of Class but for beans.

        Returns:
        the meta-bean, not null
      • property

        default <R> Property<R> property​(java.lang.String propertyName)
        Gets a property by name.

        Each bean consists of a known set of properties. This method checks whether there is a property with the specified name.

        The base interface throws an exception if the name is not recognised. By contrast, the DynamicBean subinterface creates the property on demand.

        Type Parameters:
        R - the property type, optional, enabling auto-casting
        Parameters:
        propertyName - the property name to retrieve, not null
        Returns:
        the property, not null
        Throws:
        java.util.NoSuchElementException - if the property name is invalid
      • propertyNames

        default java.util.Set<java.lang.String> propertyNames()
        Gets the set of property names.

        Each bean consists of a known set of properties. This method returns the known property names.

        Returns:
        the unmodifiable set of property names, not null