Class VersionProvider
@Rest flavors.
Holds the capability state (the assembled name/version/git*/buildTime/
javaVersion entry map) and the serve logic (write the map as readable JSON, format-pinned to
application/json so the endpoint serves JSON even on a vanilla RestServlet host that
hasn't wired up JSON serializers). The VersionMixin (mixin), VersionResource (child),
and VersionServlet (servlet) flavors are independent @Rest classes that each hold a
VersionProvider worker and delegate to it — so the three deployment forms cannot drift, and no
flavor is another flavor's worker.
See Also:
- Since:
- 10.0.0
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionNo-arg constructor — readsMANIFEST.MF,git.properties, and the JVM version from the framework classloader.protectedVersionProvider(VersionProvider.Builder builder) Builder constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic VersionProvider.Buildercreate()Creates a new builder, with@Value-annotated fields populated throughBeanInstantiatorfrom the activeSettingschain.static VersionProvider.BuilderReturns the configured info map (test/inspection helper).voidserve(RestResponse res) Serves the assembled metadata as a JSON map.
-
Field Details
-
UNKNOWN
Sentinel value returned for entries that the worker couldn't resolve.- See Also:
-
-
Constructor Details
-
VersionProvider
public VersionProvider()No-arg constructor — readsMANIFEST.MF,git.properties, and the JVM version from the framework classloader. Equivalent tocreate().build(). -
VersionProvider
Builder constructor.Applies the default lookup chain (
VersionProvider.Builder.fromManifest()+VersionProvider.Builder.fromGitProperties()+VersionProvider.Builder.fromJavaVersion()) when no other builder method has been called — ensuring that a freshly-created builder always produces a non-empty payload.- Parameters:
builder- The builder. Must not benull .
-
-
Method Details
-
create
Creates a new builder, with@Value-annotated fields populated throughBeanInstantiatorfrom the activeSettingschain.- Returns:
- A new builder.
-
create
- Parameters:
beanStore- The bean store to use for dependency injection.- Returns:
- A new builder.
-
serve
Serves the assembled metadata as a JSON map.Format-pinned to
application/json— bypasses the host's content negotiation so the endpoint serves JSON even on a vanillaRestServlethost that hasn't wired up JSON serializers explicitly.- Parameters:
res- The current REST response. Must not benull .- Throws:
IOException- If an I/O error occurs while writing the response.
-
getInfoMap
Returns the configured info map (test/inspection helper).- Returns:
- The info map.
-