Skip to content

Commit

Permalink
Make user/project context implementations extendable to reuse logic (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lauraluiz authored Apr 12, 2018
1 parent 5b47fcb commit 1ee0a24
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/

@Singleton
final class ProjectContextImpl extends Base implements ProjectContext {
public class DefaultProjectContext extends Base implements ProjectContext {

private static final Logger logger = LoggerFactory.getLogger(ProjectContext.class);
private static final String CONFIG_LANGUAGES = "application.i18n.languages";
Expand All @@ -44,7 +44,7 @@ final class ProjectContextImpl extends Base implements ProjectContext {
private final List<CurrencyUnit> currencies;

@Inject
private ProjectContextImpl(final Configuration configuration, @Named("global") final SphereClient client) {
protected DefaultProjectContext(final Configuration configuration, @Named("global") final SphereClient client) {
try {
final SphereRequest<Project> request = ProjectGet.of();
final Project project = blockingWait(client.execute(request), Duration.ofMinutes(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/

@RequestScoped
final class UserContextImpl extends Base implements UserContext {
public class DefaultUserContext extends Base implements UserContext {

private static final Logger logger = LoggerFactory.getLogger(UserContext.class);
private final List<Locale> locales;
Expand All @@ -44,7 +44,7 @@ final class UserContextImpl extends Base implements UserContext {
private final Reference<Channel> channel;

@Inject
private UserContextImpl(final Http.Context context, final ProjectContext projectContext) {
protected DefaultUserContext(final Http.Context context, final ProjectContext projectContext) {
this.locales = acceptedLocales(context, projectContext);
this.country = userCountry(context, projectContext);
this.currency = userCurrency(context, projectContext, country);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* A container for all information related to the project, such as supported countries, languages or currencies.
*/
@ImplementedBy(ProjectContextImpl.class)
@ImplementedBy(DefaultProjectContext.class)
public interface ProjectContext {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* A container for all information related to the current user, such as selected country, language or customer group.
*/
@ImplementedBy(UserContextImpl.class)
@ImplementedBy(DefaultUserContext.class)
public interface UserContext {


Expand Down

0 comments on commit 1ee0a24

Please sign in to comment.