1 .class public final enum LEnum; 2 .super Ljava/lang/Enum; 3 4 #This class is an example of how to define an enum. You have 5 #to do all of the work that java normally takes care of 6 7 .field private static final synthetic $VALUES:[LEnum; 8 9 .field public static final enum VALUE1:LEnum; 10 .field public static final enum VALUE2:LEnum; 11 12 .method static constructor <clinit>()V 13 .registers 4 14 15 #create an instance of this class for the VALUE1 value 16 new-instance v0, LEnum; 17 const-string v1, "VALUE1" 18 const/4 v2, 0 19 invoke-direct {v0, v1, v2}, LEnum;-><init>(Ljava/lang/String;I)V 20 21 #and store it in VALUE1 22 sput-object v0, LEnum;->VALUE1:LEnum; 23 24 #create an instance of this class for the VALUE2 value 25 new-instance v0, LEnum; 26 const-string v1, "VALUE2" 27 const/4 v3, 1 28 invoke-direct {v0, v1, v3}, LEnum;-><init>(Ljava/lang/String;I)V 29 30 #and store it in VALUE2 31 sput-object v0, LEnum;->VALUE2:LEnum; 32 33 #create an array of Enums, for the $VALUES member 34 const/4 v0, 2 35 new-array v0, v0, [LEnum; 36 37 #add VALUE1 to the array 38 sget-object v1, LEnum;->VALUE1:LEnum; 39 aput-object v1, v0, v2 40 41 #add VALUE2 to the array 42 sget-object v1, LEnum;->VALUE2:LEnum; 43 aput-object v1, v0, v3 44 45 #and store the array in $VALUES 46 sput-object v0, LEnum;->$VALUES:[LEnum; 47 48 return-void 49 .end method 50 51 .method private constructor <init>(Ljava/lang/String;I)V 52 .registers 3 53 invoke-direct {p0, p1, p2}, Ljava/lang/Enum;-><init>(Ljava/lang/String;I)V 54 return-void 55 .end method 56 57 .method public static valueof(Ljava/lang/String;)LEnum; 58 .registers 2 59 const-class v0, LEnum; 60 invoke-static {v0, p0}, Ljava/lang/Enum;->valueOf(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum; 61 move-result-object v1 62 check-cast v1, LEnum; 63 return-object v1 64 .end method 65 66 .method public static values()[LEnum; 67 .registers 1 68 sget-object v0, LEnum;->$VALUES:[LEnum; 69 invoke-virtual {v0}, [LEnum;->clone()Ljava/lang/Object; 70 move-result-object v0 71 check-cast v0, [LEnum; 72 return-object v0 73 .end method