title: Java-Enums- How to create with default values and access them
body: <p>i have a java enum which have to have some default values like</p>
  
  <pre><code>for the 
  
  String some default values
  int some degault values
  
  etc
  </code></pre>
  
  <p>i have created a enum like the following </p>
  
  <pre><code>package com.hexgen.tools;
  
      public enum DefaultParamsValues {
         STRING ("HEXGEN"),
  INTEGER(2013),
  DATE(new org.joda.time.LocalDate()),
  BOOLEAN(true),
  BIGINTEGER(BigInteger.valueOf(Long.MAX_VALUE)),
  LONG("1898.48");
  private  String defaultString;
  private  int defaultInteger;
  private  LocalDate defaultDate;
  private  boolean defaultBoolean;
  private  long defaultLong;
  private  BigInteger defaultBigInteger;
  public DefaultParamsValues(String strValue,int intValue,LocalDate date,boolean booleanValue,long longValue,BigInteger bigintVlaue){
      this.defaultString = strValue;
      this.defaultInteger = intValue;
      this.defaultDate = date;
      this.defaultBoolean = booleanValue;
      this.defaultLong=longValue;
      this.defaultBigInteger = bigintVlaue;
  }
      }
  </code></pre>
  
  <p>but it is giving so many issues, would some one help me to create a enum with basic values for primitive types?</p>
  
  <p>EDIT: this is how i solved it:</p>
  
  <pre><code>package com.test.poc;
  
  import java.math.BigInteger;
  import org.joda.time.LocalDate;
  
  public enum DefaultParamValues {
      STRING("HEXGEN"),
      INTEGER(123),
      DATE(new LocalDate()),
      BOOLEAN(true),
      LONGVALUE(123123),
      BIGINTEGER(BigInteger.valueOf(Long.MAX_VALUE));
  
  
  
      private  String defaultString;
      private  int defaultInteger;
      private  LocalDate defaultDate;
      private  boolean defaultBoolean;
      private  long defaultLong;
      private  BigInteger defaultBigInteger;
  
      private DefaultParamValues(String strDefaultValue) {
          defaultString = strDefaultValue;
      }
      private DefaultParamValues(int intDefaultValue) {
          defaultInteger = intDefaultValue;
      }
      private DefaultParamValues(LocalDate dateDefaultValue) {
          defaultDate = dateDefaultValue;
      }
      private DefaultParamValues(boolean booleanDefaultValue) {
          defaultBoolean = booleanDefaultValue;
      }
      private DefaultParamValues(long longDefaultValue) {
          defaultLong = longDefaultValue;
      }
      private DefaultParamValues(BigInteger bigIntegerDefaultValue) {
          defaultBigInteger = bigIntegerDefaultValue;
      }
      public String getDefaultString() {
          return defaultString;
      }
      public int getDefaultInt() {
          return defaultInteger;
      }
      public LocalDate getDefaultDate() {
          return defaultDate;
      }
  
      public boolean getDefaultBoolean() {
          return defaultBoolean;
      }
      public long getDefaultLong() {
          return defaultLong;
      }
      public BigInteger getDefaultBigInteger() {
          return defaultBigInteger;
      }
  
  }
  </code></pre>
  
  <p>Thanks</p>