Skip to content

Allow Subject method chaining #303

@mscwilson

Description

Currently, adding data to an existing Subject object must be done step by step.

// chain methods as part of the Builder configuration on initialisation
Subject eventSubject = new Subject.SubjectBuilder()
    .useragent("useragent")
    .build();

// can't chain methods afterwards
eventSubject.setUserId("example@snowplowanalytics.com");
eventSubject.setLanguage("EN");
eventSubject.setIpAddress("127.0.0.1");

It would be much nicer to be able to write

eventSubject.setUserId("example@snowplowanalytics.com")
    .setLanguage("EN")
    .setIpAddress("127.0.0.1");

This could be easily fixed by returning this from the Subject setter methods.

Metadata

Metadata

Labels

good first issueGood issue for a first time contributor.priority:lowNot on the roadmap.status:completedCompleted - but might not be released yet.type:enhancementNew features or improvements to existing features.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions