Record Class RestContext.Args
- Record Components:
resourceClass- The@Rest-annotated REST resource class. Must not benull.parentContext- The parentRestContext, ornullif this is a top-level resource.servletConfig- TheServletConfigfrom the servlet container, ornullwhen none is available.resource- The supplier that provides the resource instance during initialization. Must not benull.path- The path prefix relative to the parent. Defaults to"".beanStoreConfigurer- A pre-build hook that runs against the resolvedWritableBeanStoreafter the resource has been wired in but before anyfindXxx()memoizer fires. Defaults to a no-op.overridingParent- An optional test-time override layer installed into theoverridingParentslot of the freshly-constructedBasicBeanStore. May benull. Honored only when the resource does not declare an@Bean WritableBeanStorefactory method; user-supplied bean stores are passed through unchanged.paths- An optional programmatic override for the top-level mount-paths array (the highest-priority rung in the runtime-override chain documented onRestContext.getPaths()).null(the default) means "no programmatic override" — resolution falls through to the resource'sgetPaths()getter, thenRest.paths()(SVL-resolved per element and comma-split). An empty array explicitly clears the mount list (no top-level mounts).kind- The build-timekindof this context —ROOTfor a top-level/host/mock resource, aCHILDcarrying theRestContext.ResolvedChildfor a@Rest(children)/childrenDefssub-resource (isolated resolution, with an optional host-seeded payload), or aMIXINcarrying theRestContext.ResolvedMixinthat produced a per-mixin sub-context (parent-linked to the host so thatannotation-property walksprepend the host's@Restchain before the mixin's own).
- Enclosing class:
- RestContext
RestContext.
Bundles the small, fixed set of inputs needed to construct a RestContext into a single immutable record.
All non-required values default sensibly:
parentContext,servletConfig—null(top-level resource, no servlet container)path—""(no path prefix)beanStoreConfigurer— no-op (no pre-build bean-store mutation)overridingParent—null(no test-time override layer)
The beanStoreConfigurer hook gives test fixtures and integration code a chance to register beans on
the WritableBeanStore after the resource has been wired in but before the
findXxx() memoizers fire.
The overridingParent hook installs a BeanStore into the overridingParent slot of the
freshly-constructed BasicBeanStore so that test-time overrides resolve at tier 1 of the lookup chain
(above the resource's local @Bean factory entries and the Spring bridge). This is the
canonical Mode INJECT wiring point for juneau-junit5's TestBeanStore.
Example:
- Since:
- 10.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionArgs(Class<?> resourceClass, RestContext parentContext, jakarta.servlet.ServletConfig servletConfig, Supplier<?> resource, String path, Consumer<WritableBeanStore> beanStoreConfigurer, BeanStore overridingParent, String[] paths, RestContext.ContextKind kind) Back-compatible constructor without therestBuildercomponent (defaults it tonull ).Args(Class<?> resourceClass, RestContext parentContext, jakarta.servlet.ServletConfig servletConfig, Supplier<?> resource, String path, Consumer<WritableBeanStore> beanStoreConfigurer, BeanStore overridingParent, String[] paths, RestContext.ContextKind kind, RestBuilder<?> restBuilder) Compact canonical constructor — null-coalesces optional fields and validates required ones. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebeanStoreConfigurerrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturnstruewhen this context is a per-mixin sub-context (itskind()is aRestContext.ContextKind.Mixin).kind()Returns the value of thekindrecord component.Returns the value of theoverridingParentrecord component.Returns the value of theparentContextrecord component.path()Returns the value of thepathrecord component.String[]paths()Returns the value of thepathsrecord component.Supplier<?>resource()Returns the value of theresourcerecord component.Class<?>Returns the value of theresourceClassrecord component.RestBuilder<?>Returns the value of therestBuilderrecord component.jakarta.servlet.ServletConfigReturns the value of theservletConfigrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Args
public Args(Class<?> resourceClass, RestContext parentContext, jakarta.servlet.ServletConfig servletConfig, Supplier<?> resource, String path, Consumer<WritableBeanStore> beanStoreConfigurer, BeanStore overridingParent, String[] paths, RestContext.ContextKind kind, RestBuilder<?> restBuilder) Compact canonical constructor — null-coalesces optional fields and validates required ones. -
Args
public Args(Class<?> resourceClass, RestContext parentContext, jakarta.servlet.ServletConfig servletConfig, Supplier<?> resource, String path, Consumer<WritableBeanStore> beanStoreConfigurer, BeanStore overridingParent, String[] paths, RestContext.ContextKind kind) Back-compatible constructor without therestBuildercomponent (defaults it tonull ).The
restBuilderis then resolved duringRestContextconstruction from the resource instance's stashed builder, so call sites that don't carry one keep working unchanged.- Parameters:
resourceClass- The resource class.parentContext- The parent context, ornull .servletConfig- The servlet config, ornull .resource- The resource supplier.path- The mount path override, ornull .beanStoreConfigurer- The bean-store configurer, ornull .overridingParent- The overriding parent bean store, ornull .paths- The programmatic mount-paths override, ornull .kind- The build-timekindof this context, ornull forRestContext.ContextKind.ROOT.
-
-
Method Details
-
isMixinContext
Returnstruewhen this context is a per-mixin sub-context (itskind()is aRestContext.ContextKind.Mixin).- Returns:
truefor a mixin sub-context.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
resourceClass
Returns the value of theresourceClassrecord component.- Returns:
- the value of the
resourceClassrecord component
-
parentContext
Returns the value of theparentContextrecord component.- Returns:
- the value of the
parentContextrecord component
-
servletConfig
Returns the value of theservletConfigrecord component.- Returns:
- the value of the
servletConfigrecord component
-
resource
Returns the value of theresourcerecord component.- Returns:
- the value of the
resourcerecord component
-
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
beanStoreConfigurer
Returns the value of thebeanStoreConfigurerrecord component.- Returns:
- the value of the
beanStoreConfigurerrecord component
-
overridingParent
Returns the value of theoverridingParentrecord component.- Returns:
- the value of the
overridingParentrecord component
-
paths
Returns the value of thepathsrecord component.- Returns:
- the value of the
pathsrecord component
-
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
restBuilder
Returns the value of therestBuilderrecord component.- Returns:
- the value of the
restBuilderrecord component
-