Skip to content

Commit 933fb3e

Browse files
committed
fix cr
1 parent 325e5ef commit 933fb3e

File tree

2 files changed

+29
-26
lines changed

2 files changed

+29
-26
lines changed

src/main/java/com/github/_1c_syntax/mdclasses/mdo/MetaDataObject.java

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -124,32 +124,33 @@ public class MetaDataObject {
124124

125125
public MDObjectBase getPropertyByType(MDOType type) {
126126

127-
if (type == MDOType.CONFIGURATION) {
128-
return getConfiguration();
129-
} else if (type == MDOType.ENUM) {
130-
return get_enum();
131-
} else if (type == MDOType.INTERFACE) {
132-
return get_interface();
133-
} else if (type == MDOType.HTTP_SERVICE) {
134-
return getHttpService();
135-
} else if (type == MDOType.WEB_SERVICE) {
136-
return getWebService();
137-
} else if (type == MDOType.WS_REFERENCE) {
138-
return getWsReference();
139-
} else if (type == MDOType.XDTO_PACKAGE) {
140-
return getXdtoPackage();
141-
} else {
142-
String propertyName = type.getShortClassName();
143-
try {
144-
return (MDObjectBase) getClass()
145-
.getDeclaredField(
146-
propertyName.substring(0, 1).toLowerCase() + propertyName.substring(1))
147-
.get(this);
148-
} catch (IllegalAccessException | NoSuchFieldException e) {
149-
LOGGER.error("Can't find property for name", e);
150-
}
127+
switch (type) {
128+
case CONFIGURATION:
129+
return getConfiguration();
130+
case ENUM:
131+
return get_enum();
132+
case INTERFACE:
133+
return get_interface();
134+
case HTTP_SERVICE:
135+
return getHttpService();
136+
case WEB_SERVICE:
137+
return getWebService();
138+
case WS_REFERENCE:
139+
return getWsReference();
140+
case XDTO_PACKAGE:
141+
return getXdtoPackage();
142+
default:
143+
String propertyName = type.getShortClassName();
144+
try {
145+
return (MDObjectBase) getClass()
146+
.getDeclaredField(
147+
propertyName.substring(0, 1).toLowerCase() + propertyName.substring(1))
148+
.get(this);
149+
} catch (IllegalAccessException | NoSuchFieldException e) {
150+
LOGGER.error("Can't find property for name", e);
151+
}
151152

152-
return null;
153+
return null;
153154
}
154155
}
155156
}

src/main/java/com/github/_1c_syntax/mdclasses/metadata/additional/MDOType.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ public enum MDOType {
6060
}
6161

6262
public String getShortClassName() {
63-
if (this.equals(CONFIGURATION) || this.equals(ENUM)) {
63+
if (this == CONFIGURATION
64+
|| this == ENUM
65+
|| this == INTERFACE) {
6466
return "MDO" + shortClassName;
6567
}
6668
return shortClassName;

0 commit comments

Comments
 (0)