The very fact of asking whether you need to rethink your design indicates that you need to rethink it.
Result of your rethinking should be that you either (1) redesign the code so that it follows general practice for objects to expose behavior, not data, or (2) identify it as exceptional case where deviation of general norm is clearly justified (eg Data Transfer Object).
Technical way to make field usage enforced by interface is explained in this answer to prior question:
...Here you find a detailed example how to replace inheritance by delegation. This approach is so common, there is even an Eclipse refactoring exactly for this purpose
Applied to your case, above approach could look as follows.
First, you create a class (plain class, nothing special) with desired field(s):
public class Data {
private String user;
public void setUser(String user) { this.user = user; }
public String getUser() { return user; }
}
Next, you define the interface that allows to delegate to above class:
public interface DataSource {
public Data delegate();
//... other methods here
}
As a result, any object implementing DataSource
interface will be also forced to provide Data
functionality to work with user
String.
Worth reminding once again that you better do so only if this is clearly justified - besides already mentioned issue of exposing data instead of behavior, this also goes against the Law Of Demeter.