equal
deleted
inserted
replaced
|
1 package org.chromium.sdk.internal; |
|
2 |
|
3 import org.chromium.sdk.internal.protocol.data.RefWithDisplayData; |
|
4 import org.chromium.sdk.internal.protocol.data.SomeRef; |
|
5 |
|
6 public abstract class DataWithRef { |
|
7 public abstract long ref(); |
|
8 |
|
9 /** @return data or null */ |
|
10 public abstract RefWithDisplayData getWithDisplayData(); |
|
11 |
|
12 public static DataWithRef fromSomeRef(final SomeRef someRef) { |
|
13 return new DataWithRef() { |
|
14 @Override |
|
15 public RefWithDisplayData getWithDisplayData() { |
|
16 return someRef.asWithDisplayData(); |
|
17 } |
|
18 @Override |
|
19 public long ref() { |
|
20 return someRef.ref(); |
|
21 } |
|
22 }; |
|
23 } |
|
24 public static DataWithRef fromLong(final long ref) { |
|
25 return new DataWithRef() { |
|
26 @Override |
|
27 public RefWithDisplayData getWithDisplayData() { |
|
28 return null; |
|
29 } |
|
30 @Override |
|
31 public long ref() { |
|
32 return ref; |
|
33 } |
|
34 }; |
|
35 } |
|
36 } |