Java Setter Name Create toSetterName(String field)

Here you can find the source of toSetterName(String field)

Description

to Setter Name

License

Open Source License

Declaration

private static String toSetterName(String field) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static String toSetterName(String field) {
        if (field.length() >= 2 && Character.isUpperCase(field.charAt(1))) {
            return "set" + field;
        }// w ww  .  j  a v  a2s .  c  o  m
        return "set" + field.substring(0, 1).toUpperCase() + field.substring(1);
    }
}

Related

  1. toSetterName(String fieldName)
  2. toSetterName(String name)
  3. toSetterName(String property)