1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 package ohos.devtools.views.perftrace.bean; 17 18 import ohos.devtools.views.trace.DField; 19 20 import java.util.Objects; 21 22 /** 23 * PrefFile 24 * 25 * @since 2021/5/12 16:34 26 */ 27 public class PrefFile { 28 @DField(name = "file_id") 29 private long fileId; 30 @DField(name = "symbol") 31 private String symbol; 32 @DField(name = "path") 33 private String path; 34 35 private String fileName = ""; 36 37 /** 38 * get the fileName 39 * 40 * @return String fileName 41 */ getFileName()42 public String getFileName() { 43 return fileName; 44 } 45 46 /** 47 * get the fileId 48 * 49 * @return String fileId 50 */ getFileId()51 public long getFileId() { 52 return fileId; 53 } 54 55 /** 56 * set the fileId 57 * 58 * @param fileId fileId 59 */ setFileId(long fileId)60 public void setFileId(long fileId) { 61 this.fileId = fileId; 62 } 63 64 /** 65 * get the symbol 66 * 67 * @return symbol symbol 68 */ getSymbol()69 public String getSymbol() { 70 return symbol; 71 } 72 73 /** 74 * set the symbol 75 * 76 * @param symbol symbol 77 */ setSymbol(String symbol)78 public void setSymbol(String symbol) { 79 this.symbol = symbol; 80 } 81 82 /** 83 * get the symbol 84 * 85 * @return path path 86 */ getPath()87 public String getPath() { 88 return path; 89 } 90 91 /** 92 * use path trans to last .so file name 93 * 94 * @param path path of file 95 */ setPath(String path)96 public void setPath(String path) { 97 this.path = path; 98 if (Objects.nonNull(path) && !path.isEmpty()) { 99 int lastSplitIndex = path.lastIndexOf("/"); 100 if (lastSplitIndex > 0) { 101 this.fileName = path.substring(lastSplitIndex + 1); 102 return; 103 } 104 } 105 this.fileName = path; 106 } 107 } 108