zoukankan      html  css  js  c++  java
  • 其实你可以这样折腾java enum

    package com.geoway.pad.favourite.bean;
    /**
     * @author likehua
     * @date   20120621
     * */
    public enum FavouriteGeometeyType {
         POINT(1),
         LINE(2),
         POLYGON(2);
         int type;
         private FavouriteGeometeyType(int type){
          this.type=type;
         }
         public  int  getOriginTypeValue(){
          return this.type;
         }
        public static FavouriteGeometeyType  parseGeometryType(int type){
         if(type==1){
          return FavouriteGeometeyType.POINT;
         };
         if(type==2){
          return FavouriteGeometeyType.LINE;
         };
         if(type==3){
          return FavouriteGeometeyType.POLYGON;
         };
         return null;
        };
        public static  void main(String[] args){
    //     FavouriteGeometeyType type;
         System.out.println(FavouriteGeometeyType.parseGeometryType(1).ordinal());
         System.out.println(FavouriteGeometeyType.parseGeometryType(1).getOriginTypeValue());
         
        }
    }

  • 相关阅读:
    jenkins持续集成
    对pm2对研究
    模板⽅法模式
    python configparser模块
    Python正则表达式
    Python读写文件之换行符
    Python字符串
    Python字典
    Python列表
    爬虫 urllib,requests,lxml,bs4 小结
  • 原文地址:https://www.cnblogs.com/likehua/p/2558095.html
Copyright © 2011-2022 走看看