提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
规范化的吸气剂名称
//package com.nowjava; /** 时 代 Java 公 众 号 - nowjava.com **/ public class Main { public static void main(String[] argv) throws Exception { String propertyName = "nowjava.com"; System.out.println(normalizedGetterName(propertyName)); } public static String GETTER_PREFIX = "get"; public static String normalizedGetterName(String propertyName) { String propertyBaseName = normalizePropertyBaseName(propertyName); return GETTER_PREFIX + propertyBaseName; } /** * @param propertyName * @return */ private static String normalizePropertyBaseName(String propertyName) { /**来自 N o w J a v a . c o m - 时代Java**/ if (propertyName == null) return null; propertyName = propertyName.trim(); if (propertyName.length() < 1)