本文整理了Java中fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper.visitTagsOnServiceDefinition()
方法的一些代码示例,展示了YamlHelper.visitTagsOnServiceDefinition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlHelper.visitTagsOnServiceDefinition()
方法的具体详情如下:
包路径:fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper
类名称:YamlHelper
方法名:visitTagsOnServiceDefinition
[英]TODO: use visitor pattern for all tags, we are using them to often
[中]TODO:对所有标签使用访客模式,我们经常使用它们
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
@Nullable
private static Collection<ServiceTagInterface> create(@NotNull YAMLKeyValue yamlHash) {
final Collection<ServiceTagInterface> tags = new ArrayList<>();
YamlHelper.visitTagsOnServiceDefinition(yamlHash, args -> {
String methodName = args.getAttribute("method");
if (StringUtils.isBlank(methodName)) {
return;
}
tags.add(args);
});
return tags;
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#visitTagsOnServiceDefinition
*/
public void testVisitTagsOnServiceDefinitionWithDoubleQuote() {
YAMLKeyValue yamlKeyValue = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "foo:\n" +
" tags:\n" +
" - { name: \"kernel.event_listener\", event: \"eventName\", method: \"methodName\" }\n"
);
ListYamlTagVisitor visitor = new ListYamlTagVisitor();
YamlHelper.visitTagsOnServiceDefinition(yamlKeyValue, visitor);
assertEquals("kernel.event_listener", visitor.getItem().getName());
assertEquals("eventName", visitor.getItem().getAttribute("event"));
assertEquals("methodName", visitor.getItem().getAttribute("method"));
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#visitTagsOnServiceDefinition
*/
public void testVisitTagsOnServiceDefinitionWithQuote() {
YAMLKeyValue yamlKeyValue = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "foo:\n" +
" tags:\n" +
" - { name: 'kernel.event_listener', event: 'eventName', method: 'methodName' }\n"
);
ListYamlTagVisitor visitor = new ListYamlTagVisitor();
YamlHelper.visitTagsOnServiceDefinition(yamlKeyValue, visitor);
assertEquals("kernel.event_listener", visitor.getItem().getName());
assertEquals("eventName", visitor.getItem().getAttribute("event"));
assertEquals("methodName", visitor.getItem().getAttribute("method"));
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#visitTagsOnServiceDefinition
*/
public void testVisitTagsOnServiceDefinitionForSymfony33TagsShortcut() {
YAMLKeyValue yamlKeyValue = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "foo:\n" +
" tags:\n" +
" - kernel.event_listener\n" +
" - kernel.event_listener2\n"
);
ListYamlTagVisitor visitor = new ListYamlTagVisitor();
YamlHelper.visitTagsOnServiceDefinition(yamlKeyValue, visitor);
assertEquals("kernel.event_listener", visitor.getItem(0).getName());
assertEquals("kernel.event_listener", visitor.getItem(0).getAttribute("name"));
assertEquals("kernel.event_listener2", visitor.getItem(1).getName());
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
/**
* @see fr.adrienbrault.idea.symfony2plugin.util.yaml.YamlHelper#visitTagsOnServiceDefinition
*/
public void testVisitTagsOnServiceDefinition() {
YAMLKeyValue yamlKeyValue = YamlPsiElementFactory.createFromText(getProject(), YAMLKeyValue.class, "foo:\n" +
" tags:\n" +
" - { name: kernel.event_listener, event: eventName, method: methodName }\n" +
" - { name: kernel.event_listener2, event: eventName2, method: methodName2 }\n"
);
ListYamlTagVisitor visitor = new ListYamlTagVisitor();
YamlHelper.visitTagsOnServiceDefinition(yamlKeyValue, visitor);
assertEquals("kernel.event_listener", visitor.getItem(0).getName());
assertEquals("eventName", visitor.getItem(0).getAttribute("event"));
assertEquals("methodName", visitor.getItem(0).getAttribute("method"));
assertEquals("kernel.event_listener2", visitor.getItem(1).getName());
assertEquals("eventName2", visitor.getItem(1).getAttribute("event"));
assertEquals("methodName2", visitor.getItem(1).getAttribute("method"));
}
内容来源于网络,如有侵权,请联系作者删除!