Class DirectMetaBean

  • All Implemented Interfaces:
    MetaBean

    public abstract class DirectMetaBean
    extends Object
    implements MetaBean
    A meta-bean implementation designed for use by the code generator.
    • Field Detail

      • TEST_COVERAGE_STRING

        public static final String TEST_COVERAGE_STRING
        This constant can be used to pass into setString() to increase test coverage.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DirectMetaBean

        public DirectMetaBean()
    • Method Detail

      • isBuildable

        public boolean isBuildable()
        Description copied from interface: MetaBean
        Checks whether this bean is buildable or not.

        A buildable bean can be constructed using MetaBean.builder(). If this method returns true then builder() must return a valid builder. If this method returns false then builder() must throw UnsupportedOperationException.

        Specified by:
        isBuildable in interface MetaBean
        Returns:
        true if this bean is buildable
      • metaProperty

        public <R> MetaProperty<R> metaProperty​(String propertyName)
        Description copied from interface: MetaBean
        Gets a meta-property by name.

        Each meta-bean manages a single bean with a known set of properties. This method returns the property with the specified name.

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

        Specified by:
        metaProperty in interface MetaBean
        Type Parameters:
        R - the property type, optional, enabling auto-casting
        Parameters:
        propertyName - the property name to retrieve, not null
        Returns:
        the meta property, not null
      • metaPropertyGet

        protected MetaProperty<?> metaPropertyGet​(String propertyName)
        Gets the meta-property by name.

        This implementation returns null, and must be overridden in subclasses.

        Parameters:
        propertyName - the property name, not null
        Returns:
        the meta-property, null if not found
      • propertyGet

        protected Object propertyGet​(Bean bean,
                                     String propertyName,
                                     boolean quiet)
        Gets the value of the property.
        Parameters:
        bean - the bean to query, not null
        propertyName - the property name, not null
        quiet - true to return null if unable to read
        Returns:
        the value of the property, may be null
        Throws:
        NoSuchElementException - if the property name is invalid
      • propertySet

        protected void propertySet​(Bean bean,
                                   String propertyName,
                                   Object value,
                                   boolean quiet)
        Sets the value of the property.
        Parameters:
        bean - the bean to update, not null
        propertyName - the property name, not null
        value - the value of the property, may be null
        quiet - true to take no action if unable to write
        Throws:
        NoSuchElementException - if the property name is invalid
      • validate

        protected void validate​(Bean bean)
        Validates the values of the properties.
        Parameters:
        bean - the bean to validate, not null
        Throws:
        RuntimeException - if a property is invalid
      • toString

        public String toString()
        Returns a string that summarises the meta-bean.
        Overrides:
        toString in class Object
        Returns:
        a summary string, not null