枚举:
public enum CourseTypeEnum { VIDEO_COURSE(1,"录制课程"), LIVE_COURSE(2,"直播课程"), OFFINE_COURSE(3,"线下课程"); private int seq; private String desc; CourseTypeEnum(int seq,String desc){ this.seq=seq; this.desc=desc; } public int getSeq(){ return seq; } public String gtDesc(){ return desc; } }
抽象类:
public abstract class BaseCourseState { public static final int NEW_COURSE=1; public static final int UNAUTHED_COURSE=2; public static final int PASSED_COURSE=3; public static final int NOT_PASSED_COURSE=4; public static final int DELETED_COURSE=5; }
调用:
public class Test { public static void main(String[] args) { public void getPackgeCourse(Long packageId,Long userId){ if(packageId==CourseTypeEnum.OFFINE_COURSE.getSeq()){ return; } if(course.getState==BaseCourseState.UNAUTHED_COURSE){ return ; } } } }