| 1 | /***************************************************************************** |
| 2 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | you may not use this file except in compliance with the License. |
| 4 | You may obtain a copy of the License at |
| 5 | |
| 6 | http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | |
| 8 | Unless required by applicable law or agreed to in writing, software |
| 9 | distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | See the License for the specific language governing permissions and |
| 12 | limitations under the License. |
| 13 | |
| 14 | See NOTICE file for details. |
| 15 | *****************************************************************************/ |
| 16 | #include <jpype.h> |
| 17 | #include <pyjp.h> |
| 18 | #include <jp_classtype.h> |
| 19 | |
| 20 | // Class<java.lang.Class> has special rules |
| 21 | |
| 22 | JPClassType::JPClassType(JPJavaFrame& frame, |
| 23 | jclass clss, |
| 24 | const string& name, |
| 25 | JPClass* super, |
| 26 | JPClassList& interfaces, |
| 27 | jint modifiers) |
| 28 | : JPClass(frame, clss, name, super, interfaces, modifiers) |
| 29 | { |
| 30 | } |
| 31 | |
| 32 | JPClassType::~JPClassType() |
| 33 | = default; |
| 34 | |
| 35 | JPMatch::Type JPClassType::findJavaConversion(JPMatch& match) |
| 36 | { |
| 37 | JP_TRACE_IN("JPClass::findJavaConversion"); |
| 38 | if (nullConversion->matches(this, match) |
| 39 | || objectConversion->matches(this, match) |
| 40 | || classConversion->matches(this, match) |
| 41 | || hintsConversion->matches(this, match)) |
| 42 | return match.type; |
| 43 | return match.type = JPMatch::_none; |
| 44 | JP_TRACE_OUT; |
| 45 | } |
| 46 | |
| 47 | void JPClassType::getConversionInfo(JPConversionInfo &info) |
| 48 | { |
| 49 | JPJavaFrame frame = JPJavaFrame::outer(); |
| 50 | nullConversion->getInfo(this, info); |
| 51 | objectConversion->getInfo(this, info); |
| 52 | classConversion->getInfo(this, info); |
| 53 | hintsConversion->getInfo(this, info); |
| 54 | PyList_Append(info.ret, PyJPClass_create(frame, this).get()); |
| 55 | } |