1 /* 2 * Copyright (C) 2024 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 17 package com.android.providers.media.leveldb; 18 19 /** 20 * Container class for retrieving leveldb operation's result and status. 21 */ 22 public final class LevelDBResult { 23 24 private static final String SUCCESS_CODE = "0"; 25 private static final String NOT_FOUND_CODE = "1"; 26 27 private String mCode; 28 private String mErrorMessage; 29 30 // May be empty for update operations 31 private String mValue; 32 LevelDBResult()33 public LevelDBResult() { 34 } 35 getCode()36 public String getCode() { 37 return mCode; 38 } 39 getErrorMessage()40 public String getErrorMessage() { 41 return mErrorMessage; 42 } 43 getValue()44 public String getValue() { 45 return mValue; 46 } 47 isSuccess()48 public boolean isSuccess() { 49 return SUCCESS_CODE.equals(mCode); 50 } 51 isNotFound()52 public boolean isNotFound() { 53 return NOT_FOUND_CODE.equals(mCode); 54 } 55 } 56