001/*
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020package org.apache.hadoop.hbase.client;
021
022import org.apache.commons.lang3.StringUtils;
023import org.apache.commons.lang3.builder.EqualsBuilder;
024import org.apache.commons.lang3.builder.HashCodeBuilder;
025import org.apache.commons.lang3.builder.ToStringBuilder;
026import org.apache.yetus.audience.InterfaceAudience;
027
028/**
029 * SlowLog params object that contains detailed info as params and region name : to be used
030 * for filter purpose
031 */
032@InterfaceAudience.Private
033public class SlowLogParams {
034
035  private final String regionName;
036  private final String params;
037
038  public SlowLogParams(String regionName, String params) {
039    this.regionName = regionName;
040    this.params = params;
041  }
042
043  public SlowLogParams(String params) {
044    this.regionName = StringUtils.EMPTY;
045    this.params = params;
046  }
047
048  public String getRegionName() {
049    return regionName;
050  }
051
052  public String getParams() {
053    return params;
054  }
055
056  @Override
057  public String toString() {
058    return new ToStringBuilder(this)
059      .append("regionName", regionName)
060      .append("params", params)
061      .toString();
062  }
063
064  @Override
065  public boolean equals(Object o) {
066    if (this == o) {
067      return true;
068    }
069
070    if (o == null || getClass() != o.getClass()) {
071      return false;
072    }
073
074    SlowLogParams that = (SlowLogParams) o;
075
076    return new EqualsBuilder()
077      .append(regionName, that.regionName)
078      .append(params, that.params)
079      .isEquals();
080  }
081
082  @Override
083  public int hashCode() {
084    return new HashCodeBuilder(17, 37)
085      .append(regionName)
086      .append(params)
087      .toHashCode();
088  }
089}