All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.rexsheng.springboot.faster.system.user.domain.SysUserPost Maven / Gradle / Ivy

The newest version!
package com.github.rexsheng.springboot.faster.system.user.domain;

import com.github.rexsheng.springboot.faster.common.constant.LocaleCategoryConstant;
import com.github.rexsheng.springboot.faster.common.domain.DomainFactory;
import com.github.rexsheng.springboot.faster.i18n.ObjectMessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.util.ObjectUtils;

public class SysUserPost {

    private Integer postId;

    private String postName;

    public SysUserPost() {
    }

    public SysUserPost(Integer postId) {
        this.postId = postId;
    }

    public static SysUserPost of(String postName){
        ObjectMessageSource objectMessageSource= DomainFactory.create(ObjectMessageSource.class);
        String postId=objectMessageSource.resolveMessageToCode(postName, LocaleContextHolder.getLocale(), LocaleCategoryConstant.SYS_POST);
        if(!ObjectUtils.isEmpty(postId)){
            SysUserPost post=new SysUserPost();
            post.setPostId(Integer.valueOf(postId));
            post.setPostName(postName);
            return post;
        }
        return null;
    }

    public Integer getPostId() {
        return postId;
    }

    public void setPostId(Integer postId) {
        this.postId = postId;
    }

    public String getPostName() {
        return postName;
    }

    public void setPostName(String postName) {
        this.postName = postName;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy