Class ChenilePolymorphInitializer
java.lang.Object
org.chenile.core.init.ChenilePolymorphInitializer
- All Implemented Interfaces:
SmartInitializingSingleton
Resolves the published contract of every operation once, at startup:
- the contract name (explicit, else
<serviceId>_<operationName>) and the description (explicit, else the service's description, else generated text); - for a polymorphic operation, its provider and variants. The provider is the bean named by
@ChenilePolymorph(or JSON"polymorph"), otherwise the operation's body type selector if it implementsChenilePolymorphProvider.
initialize() may be called early by a consumer that needs the contract during startup (MCP does);
operations registered later are resolved when all singletons have been created.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ApplicationContextprivate final ChenileConfigurationprivate final Set<OperationDefinition> -
Constructor Summary
ConstructorsConstructorDescriptionChenilePolymorphInitializer(ChenileConfiguration chenileConfiguration, ApplicationContext applicationContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate List<ChenilePolymorphVariant> computeVariants(ChenileServiceDefinition serviceDefinition, OperationDefinition operationDefinition, ChenilePolymorphProvider provider) private ChenilePolymorphProviderfindProvider(ChenileServiceDefinition serviceDefinition, OperationDefinition operationDefinition) voidResolves every registered operation that has not been resolved yet.private booleanprivate voidresolveNameAndDescription(ChenileServiceDefinition serviceDefinition, OperationDefinition operationDefinition) selectorNames(ChenileServiceDefinition serviceDefinition, OperationDefinition operationDefinition) The operation's body type selectors, or the service's if the operation has none.
-
Field Details
-
chenileConfiguration
-
applicationContext
-
resolved
-
-
Constructor Details
-
ChenilePolymorphInitializer
public ChenilePolymorphInitializer(ChenileConfiguration chenileConfiguration, ApplicationContext applicationContext)
-
-
Method Details
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated()- Specified by:
afterSingletonsInstantiatedin interfaceSmartInitializingSingleton
-
initialize
public void initialize()Resolves every registered operation that has not been resolved yet. -
resolveNameAndDescription
private void resolveNameAndDescription(ChenileServiceDefinition serviceDefinition, OperationDefinition operationDefinition) -
findProvider
private ChenilePolymorphProvider findProvider(ChenileServiceDefinition serviceDefinition, OperationDefinition operationDefinition) -
selectorNames
private List<String> selectorNames(ChenileServiceDefinition serviceDefinition, OperationDefinition operationDefinition) The operation's body type selectors, or the service's if the operation has none. -
computeVariants
private List<ChenilePolymorphVariant> computeVariants(ChenileServiceDefinition serviceDefinition, OperationDefinition operationDefinition, ChenilePolymorphProvider provider) -
isBlank
-
CHENILE