Jtest logo




Contents  Previous  Next  Index

NAMING.SETA


Setter method names should start with 'set'

Description

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

Setter methods' names should start with 'set' to follow the JavaBeans naming conventions.

Example

 package NAMING;
 
 public class SETA {
     public void method(int count) {     // violation.
         _count = count;
     }
     private int _count = 0;
 }

Repair

Change accessor method name to 'set<field name>'.

 package NAMING;
 public class SETA {
     public void setCount(int count) {     // violation.
         _count = count;
     }
     private int _count = 0;
 }
 

Reference

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


Contents  Previous  Next  Index

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