Convention on Labeling Methods as Pure Functions in Java

Reading the code of some complex application. I thought it can often be useful to find out if a method has side effects by simply looking at its signature. And after checking some of these methods, I thought it would be nice to mark them as purely functional or not in order to make life easier for people reading this code in the future.

Is there some kind of convention in the Java world (javadoc, method naming pattern, etc.) that identifies a method as a pure function?

+4
source share
1 answer

You have JavaBeans conventions. See http://docstore.mik.ua/orelly/java-ent/jnut/ch06_02.htm

. JavaBeans , . , , getter setter get set.

javadoc , , .

/** 
 * This method is read only!
 */
@ReadOnly
public void setX(Object x)

/ , " " "/". : Java- , -?

IMO, , JavaBeans / javadoc , , .

+1

All Articles