418 lines
10 KiB
Smali
418 lines
10 KiB
Smali
.class final Lcom/google/gson/a;
|
|
.super Lcom/google/gson/TypeAdapter;
|
|
.source "DefaultDateTypeAdapter.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lcom/google/gson/TypeAdapter<",
|
|
"Ljava/util/Date;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private final aQg:Ljava/lang/Class;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/lang/Class<",
|
|
"+",
|
|
"Ljava/util/Date;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private final aQh:Ljava/text/DateFormat;
|
|
|
|
.field private final aQi:Ljava/text/DateFormat;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Ljava/lang/Class;II)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/Class<",
|
|
"+",
|
|
"Ljava/util/Date;",
|
|
">;II)V"
|
|
}
|
|
.end annotation
|
|
|
|
sget-object v0, Ljava/util/Locale;->US:Ljava/util/Locale;
|
|
|
|
invoke-static {p2, p3, v0}, Ljava/text/DateFormat;->getDateTimeInstance(IILjava/util/Locale;)Ljava/text/DateFormat;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {p2, p3}, Ljava/text/DateFormat;->getDateTimeInstance(II)Ljava/text/DateFormat;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-direct {p0, p1, v0, p2}, Lcom/google/gson/a;-><init>(Ljava/lang/Class;Ljava/text/DateFormat;Ljava/text/DateFormat;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method constructor <init>(Ljava/lang/Class;Ljava/lang/String;)V
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/Class<",
|
|
"+",
|
|
"Ljava/util/Date;",
|
|
">;",
|
|
"Ljava/lang/String;",
|
|
")V"
|
|
}
|
|
.end annotation
|
|
|
|
new-instance v0, Ljava/text/SimpleDateFormat;
|
|
|
|
sget-object v1, Ljava/util/Locale;->US:Ljava/util/Locale;
|
|
|
|
invoke-direct {v0, p2, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;Ljava/util/Locale;)V
|
|
|
|
new-instance v1, Ljava/text/SimpleDateFormat;
|
|
|
|
invoke-direct {v1, p2}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-direct {p0, p1, v0, v1}, Lcom/google/gson/a;-><init>(Ljava/lang/Class;Ljava/text/DateFormat;Ljava/text/DateFormat;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>(Ljava/lang/Class;Ljava/text/DateFormat;Ljava/text/DateFormat;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/Class<",
|
|
"+",
|
|
"Ljava/util/Date;",
|
|
">;",
|
|
"Ljava/text/DateFormat;",
|
|
"Ljava/text/DateFormat;",
|
|
")V"
|
|
}
|
|
.end annotation
|
|
|
|
invoke-direct {p0}, Lcom/google/gson/TypeAdapter;-><init>()V
|
|
|
|
const-class v0, Ljava/util/Date;
|
|
|
|
if-eq p1, v0, :cond_1
|
|
|
|
const-class v0, Ljava/sql/Date;
|
|
|
|
if-eq p1, v0, :cond_1
|
|
|
|
const-class v0, Ljava/sql/Timestamp;
|
|
|
|
if-ne p1, v0, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
new-instance p2, Ljava/lang/IllegalArgumentException;
|
|
|
|
new-instance p3, Ljava/lang/StringBuilder;
|
|
|
|
const-string v0, "Date type must be one of "
|
|
|
|
invoke-direct {p3, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
const-class v0, Ljava/util/Date;
|
|
|
|
invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v0, ", "
|
|
|
|
invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-class v0, Ljava/sql/Timestamp;
|
|
|
|
invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v0, ", or "
|
|
|
|
invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-class v0, Ljava/sql/Date;
|
|
|
|
invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v0, " but was "
|
|
|
|
invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p2, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p2
|
|
|
|
:cond_1
|
|
:goto_0
|
|
iput-object p1, p0, Lcom/google/gson/a;->aQg:Ljava/lang/Class;
|
|
|
|
iput-object p2, p0, Lcom/google/gson/a;->aQh:Ljava/text/DateFormat;
|
|
|
|
iput-object p3, p0, Lcom/google/gson/a;->aQi:Ljava/text/DateFormat;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private da(Ljava/lang/String;)Ljava/util/Date;
|
|
.locals 3
|
|
|
|
iget-object v0, p0, Lcom/google/gson/a;->aQi:Ljava/text/DateFormat;
|
|
|
|
monitor-enter v0
|
|
|
|
:try_start_0
|
|
iget-object v1, p0, Lcom/google/gson/a;->aQi:Ljava/text/DateFormat;
|
|
|
|
invoke-virtual {v1, p1}, Ljava/text/DateFormat;->parse(Ljava/lang/String;)Ljava/util/Date;
|
|
|
|
move-result-object p1
|
|
:try_end_0
|
|
.catch Ljava/text/ParseException; {:try_start_0 .. :try_end_0} :catch_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
:try_start_1
|
|
monitor-exit v0
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
return-object p1
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
:try_start_2
|
|
iget-object v1, p0, Lcom/google/gson/a;->aQh:Ljava/text/DateFormat;
|
|
|
|
invoke-virtual {v1, p1}, Ljava/text/DateFormat;->parse(Ljava/lang/String;)Ljava/util/Date;
|
|
|
|
move-result-object p1
|
|
:try_end_2
|
|
.catch Ljava/text/ParseException; {:try_start_2 .. :try_end_2} :catch_1
|
|
.catchall {:try_start_2 .. :try_end_2} :catchall_0
|
|
|
|
:try_start_3
|
|
monitor-exit v0
|
|
:try_end_3
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_0
|
|
|
|
return-object p1
|
|
|
|
:catch_1
|
|
:try_start_4
|
|
new-instance v1, Ljava/text/ParsePosition;
|
|
|
|
const/4 v2, 0x0
|
|
|
|
invoke-direct {v1, v2}, Ljava/text/ParsePosition;-><init>(I)V
|
|
|
|
invoke-static {p1, v1}, Lcom/google/gson/internal/a/a/a;->parse(Ljava/lang/String;Ljava/text/ParsePosition;)Ljava/util/Date;
|
|
|
|
move-result-object p1
|
|
:try_end_4
|
|
.catch Ljava/text/ParseException; {:try_start_4 .. :try_end_4} :catch_2
|
|
.catchall {:try_start_4 .. :try_end_4} :catchall_0
|
|
|
|
:try_start_5
|
|
monitor-exit v0
|
|
|
|
return-object p1
|
|
|
|
:catch_2
|
|
move-exception v1
|
|
|
|
new-instance v2, Lcom/google/gson/p;
|
|
|
|
invoke-direct {v2, p1, v1}, Lcom/google/gson/p;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
|
|
|
|
throw v2
|
|
|
|
:goto_0
|
|
monitor-exit v0
|
|
:try_end_5
|
|
.catchall {:try_start_5 .. :try_end_5} :catchall_0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final synthetic read(Lcom/google/gson/stream/JsonReader;)Ljava/lang/Object;
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
invoke-virtual {p1}, Lcom/google/gson/stream/JsonReader;->peek()Lcom/google/gson/stream/JsonToken;
|
|
|
|
move-result-object v0
|
|
|
|
sget-object v1, Lcom/google/gson/stream/JsonToken;->NULL:Lcom/google/gson/stream/JsonToken;
|
|
|
|
if-ne v0, v1, :cond_0
|
|
|
|
invoke-virtual {p1}, Lcom/google/gson/stream/JsonReader;->nextNull()V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
invoke-virtual {p1}, Lcom/google/gson/stream/JsonReader;->nextString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p1}, Lcom/google/gson/a;->da(Ljava/lang/String;)Ljava/util/Date;
|
|
|
|
move-result-object p1
|
|
|
|
iget-object v0, p0, Lcom/google/gson/a;->aQg:Ljava/lang/Class;
|
|
|
|
const-class v1, Ljava/util/Date;
|
|
|
|
if-ne v0, v1, :cond_1
|
|
|
|
return-object p1
|
|
|
|
:cond_1
|
|
const-class v1, Ljava/sql/Timestamp;
|
|
|
|
if-ne v0, v1, :cond_2
|
|
|
|
new-instance v0, Ljava/sql/Timestamp;
|
|
|
|
invoke-virtual {p1}, Ljava/util/Date;->getTime()J
|
|
|
|
move-result-wide v1
|
|
|
|
invoke-direct {v0, v1, v2}, Ljava/sql/Timestamp;-><init>(J)V
|
|
|
|
return-object v0
|
|
|
|
:cond_2
|
|
const-class v1, Ljava/sql/Date;
|
|
|
|
if-ne v0, v1, :cond_3
|
|
|
|
new-instance v0, Ljava/sql/Date;
|
|
|
|
invoke-virtual {p1}, Ljava/util/Date;->getTime()J
|
|
|
|
move-result-wide v1
|
|
|
|
invoke-direct {v0, v1, v2}, Ljava/sql/Date;-><init>(J)V
|
|
|
|
return-object v0
|
|
|
|
:cond_3
|
|
new-instance p1, Ljava/lang/AssertionError;
|
|
|
|
invoke-direct {p1}, Ljava/lang/AssertionError;-><init>()V
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public final toString()Ljava/lang/String;
|
|
.locals 2
|
|
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v1, "DefaultDateTypeAdapter"
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const/16 v1, 0x28
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
iget-object v1, p0, Lcom/google/gson/a;->aQi:Ljava/text/DateFormat;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const/16 v1, 0x29
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public final synthetic write(Lcom/google/gson/stream/JsonWriter;Ljava/lang/Object;)V
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
check-cast p2, Ljava/util/Date;
|
|
|
|
if-nez p2, :cond_0
|
|
|
|
invoke-virtual {p1}, Lcom/google/gson/stream/JsonWriter;->nullValue()Lcom/google/gson/stream/JsonWriter;
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
iget-object v0, p0, Lcom/google/gson/a;->aQi:Ljava/text/DateFormat;
|
|
|
|
monitor-enter v0
|
|
|
|
:try_start_0
|
|
iget-object v1, p0, Lcom/google/gson/a;->aQh:Ljava/text/DateFormat;
|
|
|
|
invoke-virtual {v1, p2}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p1, p2}, Lcom/google/gson/stream/JsonWriter;->value(Ljava/lang/String;)Lcom/google/gson/stream/JsonWriter;
|
|
|
|
monitor-exit v0
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception p1
|
|
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
throw p1
|
|
.end method
|