⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 player.java

📁 一些很有用的spring的书籍
💻 JAVA
字号:
package com.apress.springbook.chapter04;


/**
 * A person who plays tennis.
 */
public class Player {

    private String name;
    private Sex sex;
    private Integer id;
        
    private Player(Sex sex) {
        this.sex = sex;
    }
    
    public static Player malePlayer() {
        return new Player(Sex.MALE);
    }
    
    public static Player femalePlayer() {
        return new Player(Sex.FEMALE);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    public boolean isMale() {
        return this.sex.getClass().equals(Male.class);
    }
    
    public boolean isFemale() {
        return this.sex.getClass().equals(Female.class);
    }

    protected Sex getSex() {
        return this.sex;
    }

    public Integer getId() {
        return id;
    }
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -