Package io.jmix.core
Class FetchPlanBuilder
java.lang.Object
io.jmix.core.FetchPlanBuilder
Builds 
FetchPlans.
 
 Use FetchPlans factory to get the builder.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected Map<String,FetchPlanBuilder> protected Class<?>protected FetchPlanRepositoryprotected FetchPlansprotected booleanprotected MetaClassprotected MetadataToolsprotected Stringprotected FetchPlanprotected boolean
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedFetchPlanBuilder(FetchPlans fetchPlans, Metadata metadata, MetadataTools metadataTools, FetchPlanRepository fetchPlanRepository, Class<?> entityClass) 
- 
Method SummaryModifier and TypeMethodDescriptionAdds property.add(String property, FetchPlanBuilder builder) Adds property with FetchPlan specified bybuilder.add(String property, FetchPlanBuilder builder, FetchMode fetchMode) Adds property with FetchPlan specified bybuilder.Adds property with FetchPlan specified byfetchPlanName.Adds property with FetchPlan specified byfetchPlanNameand a specific fetch mode.add(String property, Consumer<FetchPlanBuilder> consumer) Adds property.add(String property, Consumer<FetchPlanBuilder> consumer, FetchMode fetchMode) Adds property.Adds all listed properties to FetchPlanaddFetchPlan(FetchPlan fetchPlan) Adds all properties from specifiedfetchPlan.addFetchPlan(String fetchPlanName) Adds all properties from specified byfetchPlanNameFetchPlan.Adds all system properties determined byMetadataTools.getSystemProperties(MetaClass)to FetchPlanprotected voidbuild()Builds fetch plan and makes builder immutable.
 Subsequent method invocations returns the same object.protected voidChecks whetherFetchPlanhas been built.protected FetchPlancreateFetchPlan(Class<?> entityClass, String name, List<FetchPlanProperty> properties, boolean loadPartialEntities) Class<?>protected MetaPropertyPathgetMetaPropertyPath(String property) getName()protected FetchPlanBuildergetNestedPropertyBuilder(FetchPlanBuilder builder, String name) booleanisBuilt()Deep mergesfetchPlaninto current fetchPlan by adding all properties recursively.mergeNestedProperty(String propertyPath, FetchPlan fetchPlan) Deep mergesfetchPlaninto direct or indirect property's fetchPlan by adding all properties recursively.mergeProperty(String propName, FetchPlan propFetchPlan, FetchMode propFetchMode) Deep mergesfetchPlaninto property's fetchPlan by adding all properties recursively.SetsFetchPlan.namepartial()SetsFetchPlan.loadPartialEntities()to truepartial(boolean partial) SpecifiesFetchPlan.loadPartialEntities()
- 
Field Details- 
fetchPlans
- 
metadataTools
- 
fetchPlanRepository
- 
entityClass
- 
metaClass
- 
properties
- 
builders
- 
propertiesToFetchPlans
- 
fetchModes
- 
systemPropertiesprotected boolean systemProperties
- 
loadPartialEntitiesprotected boolean loadPartialEntities
- 
name
- 
result
 
- 
- 
Constructor Details- 
FetchPlanBuilderprotected FetchPlanBuilder(FetchPlans fetchPlans, Metadata metadata, MetadataTools metadataTools, FetchPlanRepository fetchPlanRepository, Class<?> entityClass) 
 
- 
- 
Method Details- 
buildBuilds fetch plan and makes builder immutable.
 Subsequent method invocations returns the same object.- Returns:
- created FetchPlan
 
- 
createFetchPlanprotected FetchPlan createFetchPlan(Class<?> entityClass, String name, List<FetchPlanProperty> properties, boolean loadPartialEntities) 
- 
addAdds property.- Parameters:
- property- name of direct property or dot separated path to indirect property. e.g. "address.country.name"
- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
addAdds property.- Parameters:
- property- property name
- consumer- to build property fetchPlan
- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
addpublic FetchPlanBuilder add(String property, Consumer<FetchPlanBuilder> consumer, FetchMode fetchMode) Adds property.- Parameters:
- property- property name
- consumer- to build property fetchPlan
- fetchMode- fetch mode for property
- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
addAdds property with FetchPlan specified byfetchPlanName.For example: FetchPlan orderFP = fetchPlans.builder(Order.class) .addFetchPlan(FetchPlan.BASE) .add("orderLines", FetchPlan.BASE) .add("orderLines.product", FetchPlan.BASE) .build();- Parameters:
- property- name of immediate property or dot separated property path, e.g. "address.country.name"
- Throws:
- FetchPlanNotFoundException- if specified by- fetchPlanNameFetchPlan not found for entity determined by- property
- RuntimeException- if FetchPlan has been already built
 
- 
addAdds property with FetchPlan specified byfetchPlanNameand a specific fetch mode.For example: FetchPlan orderFP = fetchPlans.builder(Order.class) .addFetchPlan(FetchPlan.BASE) .add("orderLines", FetchPlan.BASE, FetchMode.UNDEFINED) .add("orderLines.product", FetchPlan.BASE, FetchMode.UNDEFINED) .build();- Parameters:
- property- name of immediate property or dot separated property path, e.g. "address.country.name"
- Throws:
- FetchPlanNotFoundException- if specified by- fetchPlanNameFetchPlan not found for entity determined by- property
- RuntimeException- if FetchPlan has been already built
 
- 
addAdds property with FetchPlan specified bybuilder.- Parameters:
- property- property name
- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
addAdds property with FetchPlan specified bybuilder.- Parameters:
- property- property name
- fetchMode- fetch mode for property
- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
addAllAdds all listed properties to FetchPlan- Parameters:
- properties- list of properties determined as for simple- add(String)method
- Throws:
- RuntimeException- if FetchPlan has been already built
- See Also:
 
- 
addSystemAdds all system properties determined byMetadataTools.getSystemProperties(MetaClass)to FetchPlan- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
addSystemPropertiesprotected void addSystemProperties()
- 
addFetchPlanAdds all properties from specifiedfetchPlan. Replaces existing nested fetchPlans.- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
addFetchPlanAdds all properties from specified byfetchPlanNameFetchPlan. Replaces existing nested fetchPlans.- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
mergeDeep mergesfetchPlaninto current fetchPlan by adding all properties recursively.- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
mergePropertypublic FetchPlanBuilder mergeProperty(String propName, @Nullable FetchPlan propFetchPlan, @Nullable FetchMode propFetchMode) Deep mergesfetchPlaninto property's fetchPlan by adding all properties recursively.- Parameters:
- propName- name of property to merge- propFetchPlanto
- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
mergeNestedPropertyDeep mergesfetchPlaninto direct or indirect property's fetchPlan by adding all properties recursively.- Parameters:
- propertyPath- name of direct property or dot separated path to indirect property to merge- propFetchPlanto
- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
partialSetsFetchPlan.loadPartialEntities()to true- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
partialSpecifiesFetchPlan.loadPartialEntities()- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
nameSetsFetchPlan.name- Throws:
- RuntimeException- if FetchPlan has been already built
 
- 
getEntityClass
- 
getName- Returns:
- FetchPlan.namefor fetchPlan under construction
 
- 
isBuiltpublic boolean isBuilt()- Returns:
- wheser FetchPlanhas been already built and builder is not modifiable anymore
 
- 
checkStateprotected void checkState()- Throws:
- RuntimeException- if FetchPlan is already built
 
- 
getMetaPropertyPath
- 
getNestedPropertyBuilder
 
-