Jtest logo




Contents  Previous  Next  Index

NAMING.GETB


Getter methods name should start with 'is'

Description

This rule flags any getter method that has an unconventional name format.

Names of getter methods that return "boolean" values should start with 'is'.

Example

 package NAMING;
 public class GETB {
     public boolean method() {     // violation.
         return _ready;
     }
     private boolean _ready = false;
 }

Repair

Change accessor method name to is<field name>.

 package NAMING;
 public class GETB {
     public boolean isReady() {
         return _ready;
     }
     private boolean _ready = false;
 }

Reference

http://www.AmbySoft.com/javaCodingStandards.pdf


Contents  Previous  Next  Index

ParaSoft logo
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft