集册 Java实例教程 设置方法

设置方法

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

387
设置方法
//来自 时   代    Java - nowjava.com

//package com.nowjava;

import java.lang.reflect.Method;


public class Main {


    public static final int SET_START = "set".length();


    public static boolean isSetter(Method method) {

        String name = method.getName();

        boolean hasOneParam = method.getParameterTypes().length == 1;

        boolean startsWithGet = (name.length() > SET_START)

                && name.startsWith("set");
                /*
                来 自
展开阅读全文