1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
25
26
27
28
29 public class JythonWrapperBase extends PyObject {
30
31 private PyObject pyObject;
32
33
34
35
36
37
38 public JythonWrapperBase(PyObject pyObject) {
39 this.pyObject = pyObject;
40 }
41
42 public PyObject getPyObject() {
43 return pyObject;
44 }
45
46 public void setPyObject(PyObject pyObject) {
47 this.pyObject = pyObject;
48 }
49
50 @Override
51 public PyObject __findattr_ex__(String name) {
52 return pyObject.__findattr_ex__(name);
53 }
54
55 @Override
56 public void __setattr__(String name, PyObject value) {
57 pyObject.__setattr__(name, value);
58 }
59
60 @Override
61 public boolean equals(Object obj) {
62 if (obj == null) {
63 return false;
64 }
65 if (this == obj) {
66 return true;
67 }
68 if (obj instanceof JythonWrapperBase) {
69 JythonWrapperBase other = (JythonWrapperBase) obj;
70 return Objects.equal(pyObject, other.pyObject);
71 }
72 return false;
73 }
74
75 @Override
76 public int hashCode() {
77 return Objects.hashCode(pyObject);
78 }
79 }
80
81