下面列出了javax.servlet.jsp.tagext.VariableInfo#getVarName ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
protected String createBeanVarDeclarations(List<String> localBeans) {
//TODO: the parser data contains no information about offsets and
//therefore it is not possible to create proper java embeddings
//inside bean declarations. We need a similar solution to what was
//done for imports, see issue #161246
StringBuilder beanDeclarationsBuff = new StringBuilder();
PageInfo pageInfo = getPageInfo();
if (pageInfo != null) {
PageInfo.BeanData[] beanData = getBeanData();
if (beanData != null) {
for (PageInfo.BeanData bean : beanData) {
if (!localBeans.contains(bean.getId())) {
beanDeclarationsBuff.append(bean.getClassName() + " " + bean.getId() + ";\n"); //NOI18N
}
}
}
if (pageInfo.isTagFile()) {
for (TagAttributeInfo info : pageInfo.getTagInfo().getAttributes()) {
if (info.getTypeName() != null) { // will be null e.g. for fragment attrs
if (!localBeans.contains(info.getName())) {
beanDeclarationsBuff.append(info.getTypeName() + " " + info.getName() + ";\n"); //NOI18N
}
}
}
}
}
JspSyntaxSupport syntaxSupport = JspSyntaxSupport.get(doc);
JspColoringData coloringData = getParserData().getColoringData();
if (coloringData != null && coloringData.getPrefixMapper() != null) {
Collection<String> prefixes = coloringData.getPrefixMapper().keySet();
TagData fooArg = new TagData((Object[][]) null);
for (String prefix : prefixes) {
List<TagInfo> tags = syntaxSupport.getAllTags(prefix, false); //do not require fresh data - #146762
for (TagInfo tag : tags) {
// #146754 - prevent NPE:
if (tag == null) {
continue;
}
VariableInfo vars[] = tag.getVariableInfo(fooArg);
if (vars != null) {
for (VariableInfo var : vars) {
// Create Variable Definitions
if (var != null && var.getVarName() != null && var.getClassName() != null && var.getDeclare()) {
String varDeclaration = var.getClassName() + " " + var.getVarName() + ";\n";
beanDeclarationsBuff.append(varDeclaration);
}
}
}
}
}
}
return beanDeclarationsBuff.toString();
}