Class BeanSchema<B>

  • Type Parameters:
    B - class that this schema covers

    public final class BeanSchema<B>
    extends Object
    Schema of a Java Bean.

    This class represents view of a java class from perspective of Java Beans. This means that instead of class fields, methods, constructors and so on, bean schema has type and PropertySchema, and can be instantiated,

    • Method Detail

      • from

        public static <X> BeanSchema<X> from​(Class<X> beanClass)
        Creates schema from provided class.
        Type Parameters:
        X - type of schema
        Parameters:
        beanClass - class to create schema from
        Returns:
        Bean schema for provided class
      • put

        public Bean<B> put​(B element)
        Inserts bean instance into this schema, creating actual Bean.
        Parameters:
        element - element to convert to bean
        Returns:
        bean from the element
      • type

        public Class<B> type()
        Class backing this schema.
        Returns:
        schema class
      • instantiate

        public Bean<B> instantiate()
        Creates new empty bean from this schema.

        This will actually invoke parameterless constructor of the class.

        Returns:
        new bean from this schema
      • property

        public PropertySchema<B,​?> property​(String name)
        Extracts property schema by name.
        Parameters:
        name - name of the schema searched
        Returns:
        property schema for provided name
        Throws:
        IllegalArgumentException - when property with this name doesn't exist in bean schema.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object