@Override public BitsTypeDefinition buildType() { final Map<String, Bit> map = builder.build(); final Map<Long, Bit> positionMap = new TreeMap<>(); for (Bit b : map.values()) { final Bit conflict = positionMap.put(b.getPosition(), b); if (conflict != null) { throw new InvalidBitDefinitionException(b, "Bit %s conflicts on position with bit ", conflict); } } return getBaseType() == null ? new BaseBitsType(getPath(), getUnknownSchemaNodes(), positionMap.values()) : new RestrictedBitsType(getBaseType(), getPath(), getUnknownSchemaNodes(), positionMap.values()); } }
@Override public BitsTypeDefinition buildType() { final Map<String, Bit> map = builder.build(); final Map<Long, Bit> positionMap = new TreeMap<>(); for (Bit b : map.values()) { final Bit conflict = positionMap.put(b.getPosition(), b); if (conflict != null) { throw new InvalidBitDefinitionException(b, "Bit %s conflicts on position with bit ", conflict); } } return getBaseType() == null ? new BaseBitsType(getPath(), getUnknownSchemaNodes(), positionMap.values()) : new RestrictedBitsType(getBaseType(), getPath(), getUnknownSchemaNodes(), positionMap.values()); } }