Back to home page

OSCL-LXR

 
 

    


0001 /**
0002  * Licensed to the Apache Software Foundation (ASF) under one
0003  * or more contributor license agreements.  See the NOTICE file
0004  * distributed with this work for additional information
0005  * regarding copyright ownership.  The ASF licenses this file
0006  * to you under the Apache License, Version 2.0 (the
0007  * "License"); you may not use this file except in compliance
0008  * with the License.  You may obtain a copy of the License at
0009  *
0010  *     http://www.apache.org/licenses/LICENSE-2.0
0011  *
0012  * Unless required by applicable law or agreed to in writing, software
0013  * distributed under the License is distributed on an "AS IS" BASIS,
0014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0015  * See the License for the specific language governing permissions and
0016  * limitations under the License.
0017  */
0018 package org.apache.hive.service.cli;
0019 
0020 import org.apache.hive.service.cli.thrift.THandleIdentifier;
0021 
0022 
0023 
0024 
0025 public abstract class Handle {
0026 
0027   private final HandleIdentifier handleId;
0028 
0029   public Handle() {
0030     handleId = new HandleIdentifier();
0031   }
0032 
0033   public Handle(HandleIdentifier handleId) {
0034     this.handleId = handleId;
0035   }
0036 
0037   public Handle(THandleIdentifier tHandleIdentifier) {
0038     this.handleId = new HandleIdentifier(tHandleIdentifier);
0039   }
0040 
0041   public HandleIdentifier getHandleIdentifier() {
0042     return handleId;
0043   }
0044 
0045   @Override
0046   public int hashCode() {
0047     final int prime = 31;
0048     int result = 1;
0049     result = prime * result + ((handleId == null) ? 0 : handleId.hashCode());
0050     return result;
0051   }
0052 
0053   @Override
0054   public boolean equals(Object obj) {
0055     if (this == obj) {
0056       return true;
0057     }
0058     if (obj == null) {
0059       return false;
0060     }
0061     if (!(obj instanceof Handle)) {
0062       return false;
0063     }
0064     Handle other = (Handle) obj;
0065     if (handleId == null) {
0066       if (other.handleId != null) {
0067         return false;
0068       }
0069     } else if (!handleId.equals(other.handleId)) {
0070       return false;
0071     }
0072     return true;
0073   }
0074 
0075   @Override
0076   public abstract String toString();
0077 
0078 }