@Test public void testParseMetaAttr() { HistoDbAttributeId attrId = HistoDbAttributeIdParser.parse("cimName"); assertTrue(attrId instanceof HistoDbMetaAttributeId); }
public static HistoDbAttributeId parse(String txt) { try { return new HistoDbMetaAttributeId(HistoDbMetaAttributeType.valueOf(txt)); } catch (IllegalArgumentException e) { for (HistoDbAttr type : HistoDbAttr.values()) { if (txt.endsWith("_" + type.name())) { String terminalId = txt.substring(0, txt.length() - 1 - type.name().length()); String equipmentId; String side = null; int pos = terminalId.indexOf(HistoDbNetworkAttributeId.SIDE_SEPARATOR); if (pos == -1) { equipmentId = terminalId; } else { equipmentId = terminalId.substring(0, pos); side = terminalId.substring(pos + HistoDbNetworkAttributeId.SIDE_SEPARATOR.length()); } return new HistoDbNetworkAttributeId(equipmentId, side, type); } } throw new IllegalArgumentException("Invalid attribute id " + txt); } }
HistoDbAttributeIdParser { public static HistoDbAttributeId parse(String txt) { try { return new HistoDbMetaAttributeId(HistoDbMetaAttributeType.valueOf(txt)); } catch (IllegalArgumentException e) { for (HistoDbAttr type : HistoDbAttr.values()) { if (txt.endsWith("_" + type.name())) { String terminalId = txt.substring(0, txt.length() - 1 - type.name().length()); String equipmentId; String side = null; int pos = terminalId.indexOf(HistoDbNetworkAttributeId.SIDE_SEPARATOR); if (pos == -1) { equipmentId = terminalId; } else { equipmentId = terminalId.substring(0, pos); side = terminalId.substring(pos + HistoDbNetworkAttributeId.SIDE_SEPARATOR.length()); } return new HistoDbNetworkAttributeId(equipmentId, side, type); } } throw new IllegalArgumentException("Invalid attribute id " + txt); } } }
HistoDbAttributeIdParser { public static HistoDbAttributeId parse(String txt) { try { return new HistoDbMetaAttributeId(HistoDbMetaAttributeType.valueOf(txt)); } catch (IllegalArgumentException e) { for (HistoDbAttr type : HistoDbAttr.values()) { if (txt.endsWith("_" + type.name())) { String terminalId = txt.substring(0, txt.length() - 1 - type.name().length()); String equipmentId; String side = null; int pos = terminalId.indexOf(HistoDbNetworkAttributeId.SIDE_SEPARATOR); if (pos == -1) { equipmentId = terminalId; } else { equipmentId = terminalId.substring(0, pos); side = terminalId.substring(pos + HistoDbNetworkAttributeId.SIDE_SEPARATOR.length()); } return new HistoDbNetworkAttributeId(equipmentId, side, type); } } throw new IllegalArgumentException("Invalid attribute id " + txt); } } private  HistoDbAttributeIdParser(); }
HistoDbAttributeIdParser { public static HistoDbAttributeId parse(String txt) { try { return new HistoDbMetaAttributeId(HistoDbMetaAttributeType.valueOf(txt)); } catch (IllegalArgumentException e) { for (HistoDbAttr type : HistoDbAttr.values()) { if (txt.endsWith("_" + type.name())) { String terminalId = txt.substring(0, txt.length() - 1 - type.name().length()); String equipmentId; String side = null; int pos = terminalId.indexOf(HistoDbNetworkAttributeId.SIDE_SEPARATOR); if (pos == -1) { equipmentId = terminalId; } else { equipmentId = terminalId.substring(0, pos); side = terminalId.substring(pos + HistoDbNetworkAttributeId.SIDE_SEPARATOR.length()); } return new HistoDbNetworkAttributeId(equipmentId, side, type); } } throw new IllegalArgumentException("Invalid attribute id " + txt); } } private  HistoDbAttributeIdParser(); static HistoDbAttributeId parse(String txt); }
HistoDbAttributeIdParser { public static HistoDbAttributeId parse(String txt) { try { return new HistoDbMetaAttributeId(HistoDbMetaAttributeType.valueOf(txt)); } catch (IllegalArgumentException e) { for (HistoDbAttr type : HistoDbAttr.values()) { if (txt.endsWith("_" + type.name())) { String terminalId = txt.substring(0, txt.length() - 1 - type.name().length()); String equipmentId; String side = null; int pos = terminalId.indexOf(HistoDbNetworkAttributeId.SIDE_SEPARATOR); if (pos == -1) { equipmentId = terminalId; } else { equipmentId = terminalId.substring(0, pos); side = terminalId.substring(pos + HistoDbNetworkAttributeId.SIDE_SEPARATOR.length()); } return new HistoDbNetworkAttributeId(equipmentId, side, type); } } throw new IllegalArgumentException("Invalid attribute id " + txt); } } private  HistoDbAttributeIdParser(); static HistoDbAttributeId parse(String txt);  }