Coverage Report - org.apache.giraph.jython.wrappers.JythonWrapperBase
 
Classes in this File Line Coverage Branch Coverage Complexity
JythonWrapperBase
0%
0/18
0%
0/6
1.857
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 package org.apache.giraph.jython.wrappers;
 19  
 
 20  
 import org.python.core.PyObject;
 21  
 
 22  
 import com.google.common.base.Objects;
 23  
 
 24  
 // CHECKSTYLE: stop MethodNameCheck
 25  
 
 26  
 /**
 27  
  * Base class for wrapping Jython objects
 28  
  */
 29  
 public class JythonWrapperBase extends PyObject {
 30  
   /** The Jython object being wrapped */
 31  
   private PyObject pyObject;
 32  
 
 33  
   /**
 34  
    * Constructor
 35  
    *
 36  
    * @param pyObject Jython object to wrap
 37  
    */
 38  0
   public JythonWrapperBase(PyObject pyObject) {
 39  0
     this.pyObject = pyObject;
 40  0
   }
 41  
 
 42  
   public PyObject getPyObject() {
 43  0
     return pyObject;
 44  
   }
 45  
 
 46  
   public void setPyObject(PyObject pyObject) {
 47  0
     this.pyObject = pyObject;
 48  0
   }
 49  
 
 50  
   @Override
 51  
   public PyObject __findattr_ex__(String name) {
 52  0
     return pyObject.__findattr_ex__(name);
 53  
   }
 54  
 
 55  
   @Override
 56  
   public void __setattr__(String name, PyObject value) {
 57  0
     pyObject.__setattr__(name, value);
 58  0
   }
 59  
 
 60  
   @Override
 61  
   public boolean equals(Object obj) {
 62  0
     if (obj == null) {
 63  0
       return false;
 64  
     }
 65  0
     if (this == obj) {
 66  0
       return true;
 67  
     }
 68  0
     if (obj instanceof JythonWrapperBase) {
 69  0
       JythonWrapperBase other = (JythonWrapperBase) obj;
 70  0
       return Objects.equal(pyObject, other.pyObject);
 71  
     }
 72  0
     return false;
 73  
   }
 74  
 
 75  
   @Override
 76  
   public int hashCode() {
 77  0
     return Objects.hashCode(pyObject);
 78  
   }
 79  
 }
 80  
 
 81  
 // CHECKSTYLE: resume MethodNameCheck