apache-ignite

Форк
0
62 строки · 2.1 Кб
1
# Licensed to the Apache Software Foundation (ASF) under one or more
2
# contributor license agreements.  See the NOTICE file distributed with
3
# this work for additional information regarding copyright ownership.
4
# The ASF licenses this file to You under the Apache License, Version 2.0
5
# (the "License"); you may not use this file except in compliance with
6
# the License.  You may obtain a copy of the License at
7
#
8
#    http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License
15

16
class Bean:
17
    """
18
    Helper class to store bean class name, optional constructor parameters and optional set of
19
    name/value pairs for properties.
20

21
    Serves as a parameter for the 'bean' jinja2 template macro used to generate lists of beans in the XML
22
    ignite node configuration (see the ignitetest/services/utils/templates/misc_macro.j2::bean).
23

24
    Hashable to be stored in a set.
25
    """
26
    def __init__(self, class_name, bean_id="", constructor_args=None, **kwargs):
27
        """
28
        :param class_name: bean class name
29
        :param bean_id: optional bean id
30
        :param constructor_args: optional list of constructor parameters
31
        :param kwargs: properties name / value pairs
32
        """
33
        if constructor_args is None:
34
            self.constructor_args = []
35
        else:
36
            self.constructor_args = constructor_args
37

38
        self.id = bean_id
39
        self.class_name = class_name
40
        self.properties = kwargs
41

42
    def __eq__(self, other):
43
        return other is not None and self.class_name == other.class_name
44

45
    def __hash__(self):
46
        return hash(self.class_name)
47

48
    def __repr__(self):
49
        return self.class_name
50

51
    class_name: str
52
    properties: {}
53

54

55
class BeanRef:
56
    """
57
    Helper class to represent property which is a bean reference.
58
    """
59
    def __init__(self, ref):
60
        self.ref = ref
61

62
    ref: str
63

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.