File: Enum.smali

package info (click to toggle)
libsmali-java 2.5.2.git2771eae-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 9,136 kB
  • sloc: java: 47,715; sh: 232; xml: 60; ansic: 46; makefile: 6
file content (73 lines) | stat: -rw-r--r-- 2,062 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.class public final enum LEnum;
.super Ljava/lang/Enum;

#This class is an example of how to define an enum. You have
#to do all of the work that java normally takes care of

.field private static final synthetic $VALUES:[LEnum;

.field public static final enum VALUE1:LEnum;
.field public static final enum VALUE2:LEnum;

.method static constructor <clinit>()V
    .registers 4

    #create an instance of this class for the VALUE1 value
    new-instance v0, LEnum;
    const-string v1, "VALUE1"
    const/4 v2, 0
    invoke-direct {v0, v1, v2}, LEnum;-><init>(Ljava/lang/String;I)V

    #and store it in VALUE1
    sput-object v0, LEnum;->VALUE1:LEnum;

    #create an instance of this class for the VALUE2 value
    new-instance v0, LEnum;
    const-string v1, "VALUE2"
    const/4 v3, 1
    invoke-direct {v0, v1, v3}, LEnum;-><init>(Ljava/lang/String;I)V

    #and store it in VALUE2
    sput-object v0, LEnum;->VALUE2:LEnum;

    #create an array of Enums, for the $VALUES member
    const/4 v0, 2
    new-array v0, v0, [LEnum;

    #add VALUE1 to the array
    sget-object v1, LEnum;->VALUE1:LEnum;
    aput-object v1, v0, v2

    #add VALUE2 to the array
    sget-object v1, LEnum;->VALUE2:LEnum;
    aput-object v1, v0, v3

    #and store the array in $VALUES
    sput-object v0, LEnum;->$VALUES:[LEnum;

    return-void
.end method

.method private constructor <init>(Ljava/lang/String;I)V
    .registers 3
    invoke-direct {p0, p1, p2}, Ljava/lang/Enum;-><init>(Ljava/lang/String;I)V
    return-void
.end method

.method public static valueof(Ljava/lang/String;)LEnum;
    .registers 2
    const-class v0, LEnum;
    invoke-static {v0, p0}, Ljava/lang/Enum;->valueOf(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
    move-result-object v1
    check-cast v1, LEnum;
    return-object v1
.end method

.method public static values()[LEnum;
    .registers 1
    sget-object v0, LEnum;->$VALUES:[LEnum;
    invoke-virtual {v0}, [LEnum;->clone()Ljava/lang/Object;
    move-result-object v0
    check-cast v0, [LEnum;
    return-object v0
.end method