Taylor Riggan created TINKERPOP-2990:
----------------------------------------
Summary: Javascript GLV: Add getters and setters for Client and
Connection classes
Key: TINKERPOP-2990
URL: https://issues.apache.org/jira/browse/TINKERPOP-2990
Project: TinkerPop
Issue Type: Improvement
Components: javascript
Affects Versions: 3.7.0
Reporter: Taylor Riggan
Java provides the ability to override a class constructor, which has allowed a
Client or Connection class in Java to be instantiated using varying different
parameters. Javascript classes only allow a single constructor. This limits a
developer's ability to access or modify class properties for a Client or
Connection object.
Example:
A DriverRemoteConnection object in gremlin-javascript can only be instantiated
via:
{code:java}
let drc = new DriverRemoteConnection(some_url);{code}
A developer would not be able to create a Client object first and create a new
DriverRemoteConnection object based on the Client as they would be able to do
using the Java GLV.
Similarly, if a user needed to gain access to an underlying Client or
Connection object from within a DriverRemoteConnection, they would be accessing
these properties using the _client or _connection variable names. The
underscore prefix typically denotes that these should be viewed as private
class properties. As such, we should be treating these as private until a time
comes as to when we can adopt actual private class properties and functions (a
fairly new concept added to JS in ES2019).
To address these issues, I suggest we add setter and getter functions to the
respective classes that would allow a user to more properly interact with class
properties that cannot be defined via overridden constructor.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)