Java tutorial
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Method; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static Pattern PASSWORD_PATTERN = Pattern.compile("password", Pattern.CASE_INSENSITIVE); private static String HIDDEN_PASSWORD_VALUE = "****"; private static Object dontShowPasswords(Object aReturnValue, Method aMethod) { Object result = aReturnValue; Matcher matcher = PASSWORD_PATTERN.matcher(aMethod.getName()); if (matcher.find()) { result = HIDDEN_PASSWORD_VALUE; } return result; } }