Revision 44352
Added by Sandro La Bruzzo over 7 years ago
DNGFRowKeyDecoder.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.mapreduce.util; |
2 | 2 |
|
3 |
import eu.dnetlib.data.proto.TypeProtos.Type; |
|
3 | 4 |
import org.apache.commons.lang3.StringUtils; |
4 | 5 |
import org.apache.commons.logging.Log; |
5 | 6 |
import org.apache.commons.logging.LogFactory; |
6 | 7 |
|
7 |
import eu.dnetlib.data.proto.TypeProtos.Type; |
|
8 |
|
|
9 | 8 |
public class DNGFRowKeyDecoder { |
10 | 9 |
|
10 |
public final static String ID_REGEX = "^[0-9][0-9]\\|.{12}::[a-zA-Z0-9]{32}$"; |
|
11 | 11 |
/** |
12 | 12 |
* logger. |
13 | 13 |
*/ |
14 | 14 |
private static final Log log = LogFactory.getLog(DNGFRowKeyDecoder.class); // NOPMD by marko on 11/24/08 5:02 PM |
15 |
|
|
16 | 15 |
private static final String SEPARATOR = "|"; |
17 |
|
|
18 |
public final static String ID_REGEX = "^[0-9][0-9]\\|.{12}::[a-zA-Z0-9]{32}$"; |
|
19 |
|
|
20 | 16 |
private String key; |
21 | 17 |
|
22 | 18 |
private Type type = null; |
23 | 19 |
|
24 | 20 |
private String id = null; |
25 | 21 |
|
26 |
public static DNGFRowKeyDecoder decode(final byte[] key) throws IllegalArgumentException { |
|
27 |
return new DNGFRowKeyDecoder(new String(key)); |
|
28 |
} |
|
29 |
|
|
30 |
public static DNGFRowKeyDecoder decode(final String key) throws IllegalArgumentException { |
|
31 |
return new DNGFRowKeyDecoder(key); |
|
32 |
} |
|
33 |
|
|
34 | 22 |
private DNGFRowKeyDecoder(final String key) throws IllegalArgumentException { |
35 | 23 |
this.key = key; |
36 | 24 |
|
... | ... | |
47 | 35 |
// System.out.println(OafRowTypeDecoder.class.getName() +" decoded key: " + split); |
48 | 36 |
} |
49 | 37 |
|
38 |
public static DNGFRowKeyDecoder decode(final byte[] key) throws IllegalArgumentException { |
|
39 |
return new DNGFRowKeyDecoder(new String(key)); |
|
40 |
} |
|
41 |
|
|
42 |
public static DNGFRowKeyDecoder decode(final String key) throws IllegalArgumentException { |
|
43 |
return new DNGFRowKeyDecoder(key); |
|
44 |
} |
|
45 |
|
|
50 | 46 |
public String getKey() { |
51 | 47 |
return key; |
52 | 48 |
} |
... | ... | |
58 | 54 |
public String getId() { |
59 | 55 |
return id; |
60 | 56 |
} |
61 |
} |
|
57 |
} |
Also available in: Unified diff
fixed bug