Let's say you implement an interface like:public interface Example {  InputStream getThatContent();}In this case there is no property, and the implementation may also have side effects (it can open a new InputStream).This is happening also in other API, like JDBC:public static Connection getConnection(String url,                       String user,                       String password)                                throws SQLExceptionThe method starts with get, and actually creates a new connection, so I'm wondering, is the getter/setter method naming convention valid only in POJO classes? Or in all Java classes?
Is it a good idea to have a method that starts with get without being an accessor?
java;coding standards;naming
The popular and accepted convention in the Java community about naming getters(1):When you want to expose private members and comply with encapsulation you should not make said members public but instead write setters and getters and that setters should be named setX(Type value) and gettets should be named Type getX().That's all.The convention doesn't prohibit non-getters from beginning with the prefix get.A method like getFullName() could return firstName+ +LastName. Note that no class variable called fullName is part of the state.The convention doesn't state that methods beginning with the prefix get must not have side-effects. For example I could write to a logfile inside a getter.Clarifying what is a POJO and what's not:A class using java.util.Collection continues to be a POJO because java.util.Collection is part of JSE. A class is not a POJO when it uses JEE or some external framework or annotations. (1) Meaning by getter a method that returns the value of a class' private member.Is it a good idea to have a method like getFullName() when the class has no fullName member?IMO it is. Besides, how will the consumer of a compiled class that has a getFullName() method know whether or not the class has a member called fullName?