1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.loganalysis.item;
17 
18 import com.android.loganalysis.parser.LogcatParser;
19 
20 import java.util.Arrays;
21 import java.util.HashSet;
22 import java.util.Set;
23 
24 /**
25  * An {@link IItem} used to store native crash info.
26  */
27 public class NativeCrashItem extends MiscLogcatItem {
28 
29     /** Constant for JSON output */
30     public static final String FINGERPRINT = "FINGERPRINT";
31 
32     private static final Set<String> ATTRIBUTES = new HashSet<String>(Arrays.asList(
33             FINGERPRINT));
34 
35     /**
36      * The constructor for {@link NativeCrashItem}.
37      */
NativeCrashItem()38     public NativeCrashItem() {
39         super(ATTRIBUTES);
40         setCategory(LogcatParser.NATIVE_CRASH);
41     }
42 
43     /**
44      * Get the fingerprint for the crash.
45      */
getFingerprint()46     public String getFingerprint() {
47         return (String) getAttribute(FINGERPRINT);
48     }
49 
50     /**
51      * Set the fingerprint for the crash.
52      */
setFingerprint(String fingerprint)53     public void setFingerprint(String fingerprint) {
54         setAttribute(FINGERPRINT, fingerprint);
55     }
56 }
57