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());
         
        }
    }

  • 相关阅读:
    python数字
    python字符串方法
    python操作符与流程控制
    网络基础和python(二)
    网络基础和python
    Ubuntu源更新
    make和makefile介绍
    JavaScript
    redis mac安装配置
    网络编程之socket(TCP,UDP)
  • 原文地址:https://www.cnblogs.com/likehua/p/2558095.html
Copyright © 2011-2022 走看看