uk.co.real_logic.sbe.xml.XmlSchemaParser.checkForValidName()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(11.3k)|赞(0)|评价(0)|浏览(47)

本文整理了Java中uk.co.real_logic.sbe.xml.XmlSchemaParser.checkForValidName()方法的一些代码示例,展示了XmlSchemaParser.checkForValidName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlSchemaParser.checkForValidName()方法的具体详情如下:
包路径:uk.co.real_logic.sbe.xml.XmlSchemaParser
类名称:XmlSchemaParser
方法名:checkForValidName

XmlSchemaParser.checkForValidName介绍

[英]Check name against validity for C++ and Java naming. Warning if not valid.
[中]检查名称与C++和java命名的有效性。警告如果无效。

代码示例

代码示例来源:origin: real-logic/simple-binary-encoding

/**
 * Construct a ValidValue given the XML node and the encodingType.
 *
 * @param node         that contains the validValue
 * @param encodingType for the enum
 */
public ValidValue(final Node node, final PrimitiveType encodingType)
{
  name = getAttributeValue(node, "name");
  description = getAttributeValueOrNull(node, "description");
  value = PrimitiveValue.parse(node.getFirstChild().getNodeValue(), encodingType);
  sinceVersion = Integer.parseInt(getAttributeValue(node, "sinceVersion", "0"));
  deprecated = Integer.parseInt(getAttributeValue(node, "deprecated", "0"));
  checkForValidName(node, name);
}

代码示例来源:origin: real-logic/simple-binary-encoding

private static void addTypeWithNameCheck(final Map<String, Type> typeByNameMap, final Type type, final Node node)
{
  if (typeByNameMap.get(type.name()) != null)
  {
    handleWarning(node, "type already exists for name: " + type.name());
  }
  checkForValidName(node, type.name());
  typeByNameMap.put(type.name(), type);
}

代码示例来源:origin: real-logic/simple-binary-encoding

/**
 * Construct a Choice given the XML node and the encodingType
 *
 * @param node         that contains the validValue
 * @param encodingType for the enum
 */
public Choice(final Node node, final PrimitiveType encodingType)
{
  name = getAttributeValue(node, "name");
  description = getAttributeValueOrNull(node, "description");
  value = PrimitiveValue.parse(node.getFirstChild().getNodeValue(), encodingType);
  sinceVersion = Integer.parseInt(getAttributeValue(node, "sinceVersion", "0"));
  deprecated = Integer.parseInt(getAttributeValue(node, "deprecated", "0"));
  // choice values are bit positions (0, 1, 2, 3, 4, etc.) from LSB to MSB
  if (value.longValue() >= (encodingType.size() * 8))
  {
    throw new IllegalArgumentException("Choice value out of bounds: " + value.longValue());
  }
  checkForValidName(node, name);
}

代码示例来源:origin: real-logic/simple-binary-encoding

private static void addMessageWithIdCheck(
  final ObjectHashSet<String> distinctNames,
  final Map<Long, Message> messageByIdMap,
  final Message message,
  final Node node)
{
  if (messageByIdMap.get((long)message.id()) != null)
  {
    handleError(node, "message template id already exists: " + message.id());
  }
  if (!distinctNames.add(message.name()))
  {
    handleError(node, "message name already exists: " + message.name());
  }
  checkForValidName(node, message.name());
  messageByIdMap.put((long)message.id(), message);
}

代码示例来源:origin: real-logic/simple-binary-encoding

checkForValidName(node, name);

代码示例来源:origin: real-logic/simple-binary-encoding

.build();
XmlSchemaParser.checkForValidName(node, field.name());

代码示例来源:origin: uk.co.real-logic/sbe

public void validate(final Node node)
{
  if (type != null)
  {
    if (semanticType != null && type.semanticType() != null && !semanticType.equals(type.semanticType()))
    {
      handleError(node, "Mismatched semanticType on type and field: " + name);
    }
  }
  checkForValidName(node, name);
}

代码示例来源:origin: uk.co.real-logic/sbe

private static void addMessageWithIdCheck(
  final Map<Long, Message> messageByIdMap, final Message message, final Node node)
{
  if (messageByIdMap.get(Long.valueOf(message.id())) != null)
  {
    handleError(node, "message template id already exists: " + message.id());
  }
  checkForValidName(node, message.name());
  messageByIdMap.put(Long.valueOf(message.id()), message);
}

代码示例来源:origin: uk.co.real-logic/sbe

/**
 * Construct a ValidValue given the XML node and the encodingType.
 *
 * @param node         that contains the validValue
 * @param encodingType for the enum
 */
public ValidValue(final Node node, final PrimitiveType encodingType)
{
  name = getAttributeValue(node, "name");
  description = getAttributeValueOrNull(node, "description");
  value = PrimitiveValue.parse(node.getFirstChild().getNodeValue(), encodingType);
  sinceVersion = Integer.parseInt(getAttributeValue(node, "sinceVersion", "0"));
  checkForValidName(node, name);
}

代码示例来源:origin: uk.co.real-logic/sbe-tool

private static void addTypeWithNameCheck(final Map<String, Type> typeByNameMap, final Type type, final Node node)
{
  if (typeByNameMap.get(type.name()) != null)
  {
    handleWarning(node, "type already exists for name: " + type.name());
  }
  checkForValidName(node, type.name());
  typeByNameMap.put(type.name(), type);
}

代码示例来源:origin: uk.co.real-logic/sbe-tool

/**
 * Construct a ValidValue given the XML node and the encodingType.
 *
 * @param node         that contains the validValue
 * @param encodingType for the enum
 */
public ValidValue(final Node node, final PrimitiveType encodingType)
{
  name = getAttributeValue(node, "name");
  description = getAttributeValueOrNull(node, "description");
  value = PrimitiveValue.parse(node.getFirstChild().getNodeValue(), encodingType);
  sinceVersion = Integer.parseInt(getAttributeValue(node, "sinceVersion", "0"));
  deprecated = Integer.parseInt(getAttributeValue(node, "deprecated", "0"));
  checkForValidName(node, name);
}

代码示例来源:origin: uk.co.real-logic/sbe-all

/**
 * Construct a ValidValue given the XML node and the encodingType.
 *
 * @param node         that contains the validValue
 * @param encodingType for the enum
 */
public ValidValue(final Node node, final PrimitiveType encodingType)
{
  name = getAttributeValue(node, "name");
  description = getAttributeValueOrNull(node, "description");
  value = PrimitiveValue.parse(node.getFirstChild().getNodeValue(), encodingType);
  sinceVersion = Integer.parseInt(getAttributeValue(node, "sinceVersion", "0"));
  deprecated = Integer.parseInt(getAttributeValue(node, "deprecated", "0"));
  checkForValidName(node, name);
}

代码示例来源:origin: uk.co.real-logic/sbe-all

private static void addTypeWithNameCheck(final Map<String, Type> typeByNameMap, final Type type, final Node node)
{
  if (typeByNameMap.get(type.name()) != null)
  {
    handleWarning(node, "type already exists for name: " + type.name());
  }
  checkForValidName(node, type.name());
  typeByNameMap.put(type.name(), type);
}

代码示例来源:origin: uk.co.real-logic/sbe

private static void addTypeWithNameCheck(final Map<String, Type> typeByNameMap, final Type type, final Node node)
{
  if (typeByNameMap.get(type.name()) != null)
  {
    handleWarning(node, "type already exists for name: " + type.name());
  }
  checkForValidName(node, type.name());
  typeByNameMap.put(type.name(), type);
}

代码示例来源:origin: uk.co.real-logic/sbe-all

/**
 * Construct a Choice given the XML node and the encodingType
 *
 * @param node         that contains the validValue
 * @param encodingType for the enum
 */
public Choice(final Node node, final PrimitiveType encodingType)
{
  name = getAttributeValue(node, "name");
  description = getAttributeValueOrNull(node, "description");
  value = PrimitiveValue.parse(node.getFirstChild().getNodeValue(), encodingType);
  sinceVersion = Integer.parseInt(getAttributeValue(node, "sinceVersion", "0"));
  deprecated = Integer.parseInt(getAttributeValue(node, "deprecated", "0"));
  // choice values are bit positions (0, 1, 2, 3, 4, etc.) from LSB to MSB
  if (value.longValue() >= (encodingType.size() * 8))
  {
    throw new IllegalArgumentException("Choice value out of bounds: " + value.longValue());
  }
  checkForValidName(node, name);
}

代码示例来源:origin: uk.co.real-logic/sbe

/**
 * Construct a Choice given the XML node and the encodingType
 *
 * @param node         that contains the validValue
 * @param encodingType for the enum
 */
public Choice(final Node node, final PrimitiveType encodingType)
{
  name = getAttributeValue(node, "name");
  description = getAttributeValueOrNull(node, "description");
  value = PrimitiveValue.parse(node.getFirstChild().getNodeValue(), encodingType);
  sinceVersion = Integer.parseInt(getAttributeValue(node, "sinceVersion", "0"));
  // choice values are bit positions (0, 1, 2, 3, 4, etc.) from LSB to MSB
  if (value.longValue() >= (encodingType.size() * 8))
  {
    throw new IllegalArgumentException("Choice value out of bounds: " + value.longValue());
  }
  checkForValidName(node, name);
}

代码示例来源:origin: uk.co.real-logic/sbe-tool

/**
 * Construct a Choice given the XML node and the encodingType
 *
 * @param node         that contains the validValue
 * @param encodingType for the enum
 */
public Choice(final Node node, final PrimitiveType encodingType)
{
  name = getAttributeValue(node, "name");
  description = getAttributeValueOrNull(node, "description");
  value = PrimitiveValue.parse(node.getFirstChild().getNodeValue(), encodingType);
  sinceVersion = Integer.parseInt(getAttributeValue(node, "sinceVersion", "0"));
  deprecated = Integer.parseInt(getAttributeValue(node, "deprecated", "0"));
  // choice values are bit positions (0, 1, 2, 3, 4, etc.) from LSB to MSB
  if (value.longValue() >= (encodingType.size() * 8))
  {
    throw new IllegalArgumentException("Choice value out of bounds: " + value.longValue());
  }
  checkForValidName(node, name);
}

代码示例来源:origin: uk.co.real-logic/sbe

private Field parseGroupField(final NodeList nodeList, final int nodeIndex) throws XPathExpressionException
{
  final String dimensionTypeName = getAttributeValue(nodeList.item(nodeIndex), "dimensionType", "groupSizeEncoding");
  Type dimensionType = typeByNameMap.get(dimensionTypeName);
  if (dimensionType == null)
  {
    handleError(nodeList.item(nodeIndex), "could not find dimensionType: " + dimensionTypeName);
  }
  else if (!(dimensionType instanceof CompositeType))
  {
    handleError(nodeList.item(nodeIndex), "dimensionType should be a composite type: " + dimensionTypeName);
    dimensionType = null;
  }
  else
  {
    ((CompositeType)dimensionType).checkForWellFormedGroupSizeEncoding(nodeList.item(nodeIndex));
  }
  final Field field = new Field.Builder()
    .name(getAttributeValue(nodeList.item(nodeIndex), "name"))
    .description(getAttributeValueOrNull(nodeList.item(nodeIndex), "description"))
    .id(Integer.parseInt(getAttributeValue(nodeList.item(nodeIndex), "id")))
    .blockLength(Integer.parseInt(getAttributeValue(nodeList.item(nodeIndex), "blockLength", "0")))
    .sinceVersion(Integer.parseInt(getAttributeValue(nodeList.item(nodeIndex), "sinceVersion", "0")))
    .dimensionType((CompositeType)dimensionType)
    .build();
  XmlSchemaParser.checkForValidName(nodeList.item(nodeIndex), field.name());
  field.groupFields(parseFieldsAndGroups(nodeList.item(nodeIndex))); // recursive call
  return field;
}

代码示例来源:origin: uk.co.real-logic/sbe-all

private static void addMessageWithIdCheck(
  final ObjectHashSet<String> distinctNames,
  final Map<Long, Message> messageByIdMap,
  final Message message,
  final Node node)
{
  if (messageByIdMap.get((long)message.id()) != null)
  {
    handleError(node, "message template id already exists: " + message.id());
  }
  if (!distinctNames.add(message.name()))
  {
    handleError(node, "message name already exists: " + message.name());
  }
  checkForValidName(node, message.name());
  messageByIdMap.put((long)message.id(), message);
}

代码示例来源:origin: uk.co.real-logic/sbe-tool

private static void addMessageWithIdCheck(
  final ObjectHashSet<String> distinctNames,
  final Map<Long, Message> messageByIdMap,
  final Message message,
  final Node node)
{
  if (messageByIdMap.get((long)message.id()) != null)
  {
    handleError(node, "message template id already exists: " + message.id());
  }
  if (!distinctNames.add(message.name()))
  {
    handleError(node, "message name already exists: " + message.name());
  }
  checkForValidName(node, message.name());
  messageByIdMap.put((long)message.id(), message);
}

相关文章