Skip to content

Commit

Permalink
Remove Singleton
Browse files Browse the repository at this point in the history
  • Loading branch information
rishi-aga committed Feb 12, 2021
1 parent 80838dd commit c503c06
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
*/
public class NoRelationshipsProjectionValidator implements Validator {

private static final Validator INSTANCE = new NoRelationshipsProjectionValidator();

public static Validator getInstance() {
return INSTANCE;
}

@Override
public void validateProjection(Collection<EntityProjection> projections) {
for (EntityProjection projection : projections) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
*/
public class SingleRootProjectionValidator implements Validator {

private static final Validator INSTANCE = new SingleRootProjectionValidator();

public static Validator getInstance() {
return INSTANCE;
}

@Override
public void validateProjection(Collection<EntityProjection> projections) {
if (projections.size() != 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class GraphQLTableExportOperation extends TableExportOperation {
public GraphQLTableExportOperation(TableExportFormatter formatter, AsyncExecutorService service,
AsyncAPI export, RequestScope scope, ResultStorageEngine engine) {
super(formatter, service, export, scope, engine,
Arrays.asList(NoRelationshipsProjectionValidator.getInstance()));
Arrays.asList(new NoRelationshipsProjectionValidator()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class JSONAPITableExportOperation extends TableExportOperation {
public JSONAPITableExportOperation(TableExportFormatter formatter, AsyncExecutorService service,
AsyncAPI export, RequestScope scope, ResultStorageEngine engine) {
super(formatter, service, export, scope, engine,
Arrays.asList(NoRelationshipsProjectionValidator.getInstance()));
Arrays.asList(new NoRelationshipsProjectionValidator()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public abstract class TableExportOperation implements Callable<AsyncAPIResult> {
private TableExport exportObj;
private RequestScope scope;
private ResultStorageEngine engine;
private List<Validator> validators = new ArrayList<>(Arrays.asList(SingleRootProjectionValidator.getInstance()));
private List<Validator> validators = new ArrayList<>(Arrays.asList(new SingleRootProjectionValidator()));

public TableExportOperation(TableExportFormatter formatter, AsyncExecutorService service,
AsyncAPI exportObj, RequestScope scope, ResultStorageEngine engine, List<Validator> validators) {
Expand Down

0 comments on commit c503c06

Please sign in to comment.