Class QueryModel<T>
- Type Parameters:
T- The bean type.
Built from Juneau's BeanMeta, so it follows the same bean rules as serializers and parsers:
- getters, setters and fields;
- records;
@BeanIgnoreand@BeanProp;- the configured
PropertyNamer.
"*") properties are excluded. A class that isn't a bean (for example, one with no properties)
yields an empty model rather than an error.
Example:
QueryModel<Person>
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns the bean class.Returns the names of the properties passed to the constructor, in parameter order.Returns the constructor parameter types, parallel togetConstructorArgs().Returns the readable properties (the query columns), keyed by name, in bean property order.getReadableProperty(String name) Returns a readable property.Returns the writable properties (setter or non-final field), keyed by name, in bean property order.newInstance(Object... args) Creates an instance.static <T> QueryModel<T>Builds a model withBeanConfigContext.DEFAULT.static <T> QueryModel<T>of(Class<T> beanClass, BeanConfigContext config) Builds a model with the given bean configuration.static <T> QueryModel<T>Builds a model from existing bean metadata.
-
Method Details
-
of
Builds a model withBeanConfigContext.DEFAULT.- Type Parameters:
T- The bean type.- Parameters:
beanClass- The bean class. Must not benull .- Returns:
- A new model.
-
of
Builds a model with the given bean configuration.- Type Parameters:
T- The bean type.- Parameters:
beanClass- The bean class. Must not benull .config- The bean configuration. Must not benull .- Returns:
- A new model.
-
of
Builds a model from existing bean metadata.- Type Parameters:
T- The bean type.- Parameters:
beanMeta- The bean metadata. Must not benull .- Returns:
- A new model.
-
getBeanClass
Returns the bean class.- Returns:
- The bean class. Never
null .
-
getReadableProperties
Returns the readable properties (the query columns), keyed by name, in bean property order. Write-only properties are excluded.- Returns:
- An unmodifiable map. Never
null .
-
getReadableProperty
Returns a readable property. Write-only properties are excluded.- Parameters:
name- The property name.- Returns:
- The property, or
null if there is no readable property with that name.
-
getWritableProperties
Returns the writable properties (setter or non-final field), keyed by name, in bean property order. Read-only properties are excluded.Record components are not listed here; they are set through the constructor (see
getConstructorArgs()).- Returns:
- An unmodifiable map. Never
null .
-
getConstructorArgs
Returns the names of the properties passed to the constructor, in parameter order.Non-empty for records (canonical constructor) and
@BeanCtorclasses; empty for no-arg beans.- Returns:
- An unmodifiable list. Never
null .
-
getConstructorArgTypes
Returns the constructor parameter types, parallel togetConstructorArgs().- Returns:
- An unmodifiable list. Never
null .
-
newInstance
Creates an instance.Non-static inner classes are not supported (they need an outer instance); the model reports no usable constructor for them.
- Parameters:
args- The constructor arguments, parallel togetConstructorArgs()(none for a no-arg bean). Anull for a primitive parameter becomes that primitive's default. To pass a singlenull argument, pass(Object) .null - Returns:
- A new instance. Never
null . - Throws:
IllegalArgumentException- If the args array isnull , or the argument count doesn't matchgetConstructorArgs().IllegalStateException- If the class has no usable constructor.BeanQueryExecutionException- If the constructor throws, or the arguments can't be passed to it (for example, a wrong type). The cause is the constructor's own exception, or the reflection error.
-