Class BeanSchema<B>
- java.lang.Object
-
- org.perfectable.introspection.bean.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
static <X> BeanSchema<X>
from(Class<X> beanClass)
Creates schema from provided class.int
hashCode()
Bean<B>
instantiate()
Creates new empty bean from this schema.PropertySchema<B,?>
property(String name)
Extracts property schema by name.Bean<B>
put(B element)
Inserts bean instance into this schema, creating actualBean
.Class<B>
type()
Class backing this schema.
-
-
-
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 actualBean
.- Parameters:
element
- element to convert to bean- Returns:
- bean from the element
-
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.
-
-