net.sourceforge.pmd.Rule.getPropertyDescriptor()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(176)

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

Rule.getPropertyDescriptor介绍

暂无

代码示例

代码示例来源:origin: pmd/pmd

@Override
public PropertyDescriptor<?> getPropertyDescriptor(String name) {
  return rule.getPropertyDescriptor(name);
}

代码示例来源:origin: pmd/pmd

protected boolean isVariable(String name) {
  return StringUtil.isAnyOf(name, "variableName", "methodName", "className", "packageName")
      || rule.getPropertyDescriptor(name) != null;
}

代码示例来源:origin: pmd/pmd

protected String getVariableValue(String name) {
  if ("variableName".equals(name)) {
    return variableName;
  } else if ("methodName".equals(name)) {
    return methodName;
  } else if ("className".equals(name)) {
    return className;
  } else if ("packageName".equals(name)) {
    return packageName;
  } else {
    final PropertyDescriptor<?> propertyDescriptor = rule.getPropertyDescriptor(name);
    return String.valueOf(rule.getProperty(propertyDescriptor));
  }
}

代码示例来源:origin: pmd/pmd

/**
 * Overrides the rule's properties with the values defined in the element.
 *
 * @param rule          The rule
 * @param propertiesElt The {@literal <properties>} element
 */
private void setPropertyValues(Rule rule, Element propertiesElt) {
  Map<String, String> overridden = getPropertyValuesFrom(propertiesElt);
  for (Entry<String, String> e : overridden.entrySet()) {
    PropertyDescriptor<?> descriptor = rule.getPropertyDescriptor(e.getKey());
    if (descriptor == null) {
      throw new IllegalArgumentException(
          "Cannot set non-existent property '" + e.getKey() + "' on Rule " + rule.getName());
    }
    setRulePropertyCapture(rule, descriptor, e.getValue());
  }
}

代码示例来源:origin: pmd/pmd

for (Map.Entry<Object, Object> entry : test.getProperties().entrySet()) {
  String propertyName = (String) entry.getKey();
  PropertyDescriptor propertyDescriptor = rule.getPropertyDescriptor(propertyName);
  if (propertyDescriptor == null) {
    throw new IllegalArgumentException(

代码示例来源:origin: pmd/pmd

for (final PropertyDescriptor<?> prop : getPropertyDescriptors()) {
  if (rule.getPropertyDescriptor(prop.name()) == null) {

代码示例来源:origin: net.sourceforge.pmd/pmd-core

@Override
public PropertyDescriptor<?> getPropertyDescriptor(String name) {
  return rule.getPropertyDescriptor(name);
}

代码示例来源:origin: net.sourceforge.pmd/pmd-core

protected boolean isVariable(String name) {
  return StringUtil.isAnyOf(name, "variableName", "methodName", "className", "packageName")
      || rule.getPropertyDescriptor(name) != null;
}

代码示例来源:origin: net.sourceforge.pmd/pmd-core

protected String getVariableValue(String name) {
  if ("variableName".equals(name)) {
    return variableName;
  } else if ("methodName".equals(name)) {
    return methodName;
  } else if ("className".equals(name)) {
    return className;
  } else if ("packageName".equals(name)) {
    return packageName;
  } else {
    final PropertyDescriptor<?> propertyDescriptor = rule.getPropertyDescriptor(name);
    return String.valueOf(rule.getProperty(propertyDescriptor));
  }
}

代码示例来源:origin: net.sourceforge.pmd/pmd-core

/**
 * Overrides the rule's properties with the values defined in the element.
 *
 * @param rule          The rule
 * @param propertiesElt The {@literal <properties>} element
 */
private void setPropertyValues(Rule rule, Element propertiesElt) {
  Map<String, String> overridden = getPropertyValuesFrom(propertiesElt);
  for (Entry<String, String> e : overridden.entrySet()) {
    PropertyDescriptor<?> descriptor = rule.getPropertyDescriptor(e.getKey());
    if (descriptor == null) {
      throw new IllegalArgumentException(
          "Cannot set non-existent property '" + e.getKey() + "' on Rule " + rule.getName());
    }
    setRulePropertyCapture(rule, descriptor, e.getValue());
  }
}

代码示例来源:origin: guru.nidi/code-assert

private void setProperty(RuleSets ruleSets, String rule, String property, Object value) {
    final Rule r = ruleSets.getRuleByName(rule);
    if (r == null) {
      throw new AnalyzerException("Rule '" + rule + "' not existing.");
    }
    final PropertyDescriptor<Object> descriptor = (PropertyDescriptor<Object>) r.getPropertyDescriptor(property);
    if (descriptor == null) {
      throw new AnalyzerException("Property '" + property + "' for rule '" + rule + "' not existing.");
    }
    r.setProperty(descriptor, value);
  }
}

代码示例来源:origin: nidi3/code-assert

private void setProperty(RuleSets ruleSets, String rule, String property, Object value) {
    final Rule r = ruleSets.getRuleByName(rule);
    if (r == null) {
      throw new AnalyzerException("Rule '" + rule + "' not existing.");
    }
    final PropertyDescriptor<Object> descriptor = (PropertyDescriptor<Object>) r.getPropertyDescriptor(property);
    if (descriptor == null) {
      throw new AnalyzerException("Property '" + property + "' for rule '" + rule + "' not existing.");
    }
    r.setProperty(descriptor, value);
  }
}

代码示例来源:origin: net.sourceforge.pmd/pmd-test

for (Map.Entry<Object, Object> entry : test.getProperties().entrySet()) {
  String propertyName = (String) entry.getKey();
  PropertyDescriptor propertyDescriptor = rule.getPropertyDescriptor(propertyName);
  if (propertyDescriptor == null) {
    throw new IllegalArgumentException(

代码示例来源:origin: net.sourceforge.pmd/pmd-core

for (final PropertyDescriptor<?> prop : getPropertyDescriptors()) {
  if (rule.getPropertyDescriptor(prop.name()) == null) {

相关文章