I had written a piece of code along the lines of:
public abstract class TestService extends Base {
protected final MappedObject<A, B> mappedObject;
public TestService(Provider provider, ObjectMapper objectMapper) {
mappedObject = new MappedObject.Builder<A, B>(...);
...
}
...
}
However, I have been instructed to prefix this
to mappedObject, as it is convention when it comes to setting instance variables. Is this true?
I was under the impression that this
as a prefix would only need to be used if there were a parameter with the same name that could cause ambiguity. Hence, a this
would be necessary to reference the instance variable rather than the argument passed.