Class InMemoryBeanQueryContext<T>
- Type Parameters:
T- The row (bean) type.
BeanQueryContext: runs BeanQuerys against an in-JVM collection of beans or maps.
create(Class) declares one column per readable Juneau bean property: getters (getX(), or
isX() for booleans), public fields, and record components, named and filtered by the same rules serializers
use (@BeanIgnore, @BeanProp, the property namer). The value type is inferred
from the property type. Use create(Class, BeanConfigContext) or create(BeanMeta) to apply a
specific bean configuration. Nothing else is queryable: class, toString and other methods are not
columns. Narrow the list with exclude or
columns, add derived columns with column plus accessor, and scope every session with a server-only
guard. create() is for Map rows: declare each column, and it is
read by key.
The context holds no rows. Open a session over a specific collection with getSession(Collection) or
createSession().
Example:
InMemoryBeanQueryContext<Person>
- Since:
- 10.0.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a builder initialized from this context.static <T> InMemoryBeanQueryContext.Builder<T>create()Returns a builder forMaprows.static <T> InMemoryBeanQueryContext.Builder<T>Returns a builder whose columns are the bean's readable properties, perBeanConfigContext.DEFAULT.static <T> InMemoryBeanQueryContext.Builder<T>create(Class<T> beanClass, BeanConfigContext config) Returns a builder whose columns are the bean's readable properties under the given bean configuration.static <T> InMemoryBeanQueryContext.Builder<T>Returns a builder whose columns are the readable properties of existing bean metadata.Returns a builder for a session over this context.getSession(Collection<? extends T> rows) Opens a session over a collection with this context's settings as-is.Methods inherited from class org.apache.juneau.commons.beanquery.BeanQueryContext
checkOrigin, columns, getColumnType, getMaxSearchClauses, getMaxSortKeys, operatorSet, operatorSet, resolve
-
Method Details
-
create
Returns a builder whose columns are the bean's readable properties, perBeanConfigContext.DEFAULT.- Type Parameters:
T- The bean type.- Parameters:
beanClass- The bean class. Must not benull .- Returns:
- A new builder.
-
create
public static <T> InMemoryBeanQueryContext.Builder<T> create(Class<T> beanClass, BeanConfigContext config) Returns a builder whose columns are the bean's readable properties under the given bean configuration.Pass the configuration your serializer uses so column names match the property names it emits.
- Type Parameters:
T- The bean type.- Parameters:
beanClass- The bean class. Must not benull .config- The bean configuration. Must not benull .- Returns:
- A new builder.
-
create
Returns a builder whose columns are the readable properties of existing bean metadata.- Type Parameters:
T- The bean type.- Parameters:
beanMeta- The bean metadata. Must not benull .- Returns:
- A new builder.
-
create
Returns a builder forMaprows. It has no columns until you declare them.- Type Parameters:
T- The row type, usuallyMap<String,Object>.- Returns:
- A new builder.
-
copy
Description copied from class:BeanQueryContextReturns a builder initialized from this context. Building it leaves this context unchanged.- Specified by:
copyin classBeanQueryContext<T>- Returns:
- A new builder.
-
createSession
Description copied from class:BeanQueryContextReturns a builder for a session over this context.- Specified by:
createSessionin classBeanQueryContext<T>- Returns:
- A new session builder.
-
getSession
Opens a session over a collection with this context's settings as-is.- Parameters:
rows- The rows. Must not benull .- Returns:
- A new session.
-