|
1 | | -/* |
2 | | - * This file is a part of MDClasses. |
3 | | - * |
4 | | - * Copyright © 2019 - 2020 |
5 | | - * Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors |
6 | | - * |
7 | | - * SPDX-License-Identifier: LGPL-3.0-or-later |
8 | | - * |
9 | | - * MDClasses is free software; you can redistribute it and/or |
10 | | - * modify it under the terms of the GNU Lesser General Public |
11 | | - * License as published by the Free Software Foundation; either |
12 | | - * version 3.0 of the License, or (at your option) any later version. |
13 | | - * |
14 | | - * MDClasses is distributed in the hope that it will be useful, |
15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | | - * Lesser General Public License for more details. |
18 | | - * |
19 | | - * You should have received a copy of the GNU Lesser General Public |
20 | | - * License along with MDClasses. |
21 | | - */ |
22 | | -package com.github._1c_syntax.mdclasses.metadata.additional; |
23 | | - |
24 | | -import com.github._1c_syntax.mdclasses.mdo.MDOAttribute; |
25 | | -import com.github._1c_syntax.mdclasses.mdo.MDObjectBase; |
26 | | -import lombok.Data; |
27 | | -import lombok.EqualsAndHashCode; |
28 | | -import lombok.ToString; |
29 | | - |
30 | | -/** |
31 | | - * Класс-ссылка на объект в формате ВидОбъектаМетаданных.ИмяОбъекта |
32 | | - */ |
33 | | -@Data |
34 | | -@EqualsAndHashCode(of = {"mdoRef"}) |
35 | | -@ToString(of = {"mdoRef"}) |
36 | | -public class MDOReference { |
37 | | - |
38 | | - /** |
39 | | - * Тип объекта метаданных |
40 | | - */ |
41 | | - private MDOType type; |
42 | | - |
43 | | - /** |
44 | | - * Строковое представление ссылки |
45 | | - */ |
46 | | - private String mdoRef; |
47 | | - |
48 | | - public MDOReference(MDObjectBase mdo) { |
49 | | - type = mdo.getType(); |
50 | | - mdoRef = getType().getName() + "." + mdo.getName(); |
51 | | - } |
52 | | - |
53 | | - /** |
54 | | - * Создает ссылку для дочерних объектов |
55 | | - * |
56 | | - * @param mdo - Объект метаданных |
57 | | - * @param parent - Родительский объект |
58 | | - */ |
59 | | - public MDOReference(MDObjectBase mdo, MDObjectBase parent) { |
60 | | - this(mdo); |
61 | | - if (mdo instanceof MDOAttribute) { |
62 | | - mdoRef = ((MDOAttribute) mdo).getAttributeType().getClassName() + "." + mdo.getName(); |
63 | | - } |
64 | | - |
65 | | - if (parent.getMdoReference() != null) { |
66 | | - mdoRef = parent.getMdoReference().getMdoRef() + "." + mdoRef; |
67 | | - } |
68 | | - } |
69 | | -} |
| 1 | +/* |
| 2 | + * This file is a part of MDClasses. |
| 3 | + * |
| 4 | + * Copyright © 2019 - 2020 |
| 5 | + * Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors |
| 6 | + * |
| 7 | + * SPDX-License-Identifier: LGPL-3.0-or-later |
| 8 | + * |
| 9 | + * MDClasses is free software; you can redistribute it and/or |
| 10 | + * modify it under the terms of the GNU Lesser General Public |
| 11 | + * License as published by the Free Software Foundation; either |
| 12 | + * version 3.0 of the License, or (at your option) any later version. |
| 13 | + * |
| 14 | + * MDClasses is distributed in the hope that it will be useful, |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | + * Lesser General Public License for more details. |
| 18 | + * |
| 19 | + * You should have received a copy of the GNU Lesser General Public |
| 20 | + * License along with MDClasses. |
| 21 | + */ |
| 22 | +package com.github._1c_syntax.mdclasses.metadata.additional; |
| 23 | + |
| 24 | +import com.github._1c_syntax.mdclasses.mdo.MDOAttribute; |
| 25 | +import com.github._1c_syntax.mdclasses.mdo.MDObjectBase; |
| 26 | +import com.github._1c_syntax.mdclasses.metadata.additional.MDOType; |
| 27 | +import lombok.Data; |
| 28 | +import lombok.EqualsAndHashCode; |
| 29 | +import lombok.ToString; |
| 30 | + |
| 31 | +/** |
| 32 | + * Класс-ссылка на объект в формате ВидОбъектаМетаданных.ИмяОбъекта |
| 33 | + */ |
| 34 | +@Data |
| 35 | +@EqualsAndHashCode(of = {"mdoRef"}) |
| 36 | +@ToString(of = {"mdoRef"}) |
| 37 | +public class MDOReference { |
| 38 | + |
| 39 | + /** |
| 40 | + * Тип объекта метаданных |
| 41 | + */ |
| 42 | + private MDOType type; |
| 43 | + |
| 44 | + /** |
| 45 | + * Строковое представление ссылки |
| 46 | + */ |
| 47 | + private String mdoRef; |
| 48 | + |
| 49 | + public MDOReference(MDObjectBase mdo) { |
| 50 | + type = mdo.getType(); |
| 51 | + mdoRef = getType().getName() + "." + mdo.getName(); |
| 52 | + } |
| 53 | + |
| 54 | + /** |
| 55 | + * Создает ссылку для дочерних объектов |
| 56 | + * |
| 57 | + * @param mdo - Объект метаданных |
| 58 | + * @param parent - Родительский объект |
| 59 | + */ |
| 60 | + public MDOReference(MDObjectBase mdo, MDObjectBase parent) { |
| 61 | + this(mdo); |
| 62 | + if (mdo instanceof MDOAttribute) { |
| 63 | + mdoRef = ((MDOAttribute) mdo).getAttributeType().getClassName() + "." + mdo.getName(); |
| 64 | + } |
| 65 | + |
| 66 | + if (parent.getMdoReference() != null) { |
| 67 | + mdoRef = parent.getMdoReference().getMdoRef() + "." + mdoRef; |
| 68 | + } |
| 69 | + } |
| 70 | +} |
0 commit comments