remove Bean Method Prefix - Java Reflection

Java examples for Reflection:Method Name

Description

remove Bean Method Prefix

Demo Code


//package com.java2s;

public class Main {


    public static String removeBeanMethodPrefix(String methodName) {
        if (methodName.startsWith("get")) { //NOI18N
            methodName = methodName.replaceFirst("get", "");
        }//from w  ww.j  a v  a  2s  .  co m
        if (methodName.startsWith("set")) { //NOI18N
            methodName = methodName.replaceFirst("set", "");
        }
        if (methodName.startsWith("is")) { //NOI18N
            methodName = methodName.replaceFirst("is", "");
        }
        return methodName;
    }
}

Related Tutorials