// decompiled version of BreedM so that you can see how it
// works under the hood.

package com.mindprod.example;

// Note the final. You cannot extend enum.
// This won't compile since the compiler won't let you
// extend the Enum class manually.
public final class BreedM extends Enum
   {

   // Compiler automatically generates a values method
   // using the genenated $VALUES list of all possible enums
   public static final BreedM[] values()
      {
      return(BreedM[])$VALUES.clone();
      }

   // Compiler automatically generates a valueOf method
   // If there is no match for the String, valueOf will throw an
   // IllegalArgumentException.
   public static BreedM valueOf(String s)
      {
      return(BreedM)Enum.valueOf(com.mindprod.example.BreedM, s);
      }

   // This method common to all enum constants is just a garden-variety
   // instance method.
   public String getColours()
      {
      return colours;
      }

   /**
   * constructor with two hidden parameters and one explicit one
   * the colours.
   */
   private BreedM(String s, int i, String s1)
      {
      super(s, i);
      colours = s1;
      }

   // Named references to each of the enum constant objects.
   // Note how they are all public even though we did not
   // explicitly declare them so.
   public static final BreedM DACHSHUND;
   public static final BreedM DALMATIAN;
   public static final BreedM LABRADOR;

   // field common to all enum constants is just an ordinary
   // instance field.
   private String colours;

   // Compiler automatically generates a list of all
   // possible enum constants.
   private static final BreedM $VALUES[];

   static
   {
      // initialilsation with constructors with two hidden pararmeters
      // and our explicit one.
      DACHSHUND = new BreedM("DACHSHUND", 0, "brown");
      DALMATIAN = new BreedM("DALMATIAN", 1, "spotted");
      LABRADOR = new BreedM("LABRADOR", 2, "black or tan");

      // construct the $VALUES array
      $VALUES = (new BreedM[] {
                    DACHSHUND, DALMATIAN, LABRADOR
                 });
   }
   }