Skip to content

Audit and align class visibility modifiers in recommendation module #37

@Schmarvinius

Description

@Schmarvinius

Summary

Resolve inconsistent visibility modifiers in the cds-feature-recommendations module and clarify what constitutes public API.

Problem

Class Current Visibility Expected
RptInferenceClient public Unclear
FioriRecommendationHandler package-private Correct
MockRecommendationClient package-private Correct
RecommendationClient package-private Correct
RecommendationClientResolver package-private Correct

In cds-services, the convention is:

  • Public: CdsRuntimeConfiguration implementations and service interfaces
  • Package-private: Everything else (handlers, clients, utilities)

RptInferenceClient is currently public, and it is used externally by the sample bookshop:

// samples/bookshop/.../AICoreShowcaseHandler.java:146
new RptInferenceClient(service.inferenceClient(rg, deploymentId), service.getRetry());

Decision Needed

Option A: RptInferenceClient is intentional public API

  • Add Javadoc documenting it as a public utility for applications that need direct RPT access
  • No visibility change

Option B: RptInferenceClient should be internal

  • Make package-private
  • Update sample to use AICoreService API directly (without manually constructing inference clients)
  • Consider adding a convenience method to AICoreService or a public factory if the use case is legitimate

Recommendation

Option B aligns better with cds-services conventions. The sample should demonstrate the recommended way to use the library, not internal implementation shortcuts.

Files

  • RptInferenceClient.java (visibility change or Javadoc)
  • Possibly: samples/bookshop/.../AICoreShowcaseHandler.java (if updating sample usage)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions