集册 Java实例教程 标准化的二传手名字

标准化的二传手名字

欢马劈雪     最近更新时间:2020-01-02 10:19:05

570
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
标准化的二传手名字
//nowjava - 时  代  Java

//package com.nowjava;


public class Main {

    public static void main(String[] argv) throws Exception {

        String propertyName = "nowjava.com";

        System.out.println(normalizedSetterName(propertyName));

    }


    public static String SETTER_PREFIX = "set";


    public static String normalizedSetterName(String propertyName) {

        String propertyBaseName = normalizePropertyBaseName(propertyName);

        return SETTER_PREFIX + propertyBaseName;

    }


    /**

     * @param propertyName

     * @return

     */

    private static String normalizePropertyBaseName(String propertyName) {

        if (propertyName == null)

            return null;

        propertyName = propertyName.trim();//from n o w  j a v a  . c o m

        if (propertyName.length() < 1)

            
展开阅读全文