void visitXmlElement(XmlElement element, ElementStub parent, int index) { DomInvocationHandler handler = myManager.getDomHandler(element); if (handler == null || handler.getAnnotation(Stubbed.class) == null && !handler.getChildDescription().isStubbed()) return; AbstractDomChildrenDescription description = handler.getChildDescription(); String nsKey = description instanceof DomChildrenDescription ? ((DomChildrenDescription)description).getXmlName().getNamespaceKey() : ""; if (element instanceof XmlTag) { XmlTag tag = (XmlTag)element; String elementClass = null; if (handler.getAnnotation(StubbedOccurrence.class) != null) { final Type type = description.getType(); elementClass = ((Class)type).getName(); } ElementStub stub = new ElementStub(parent, StringRef.fromString(tag.getName()), StringRef.fromNullableString(nsKey), index, description instanceof CustomDomChildrenDescription, elementClass == null ? null : StringRef.fromNullableString(elementClass), tag.getSubTags().length == 0 ? tag.getValue().getTrimmedText() : ""); for (XmlAttribute attribute : tag.getAttributes()) { visitXmlElement(attribute, stub, 0); } Map<String, Integer> indices = new HashMap<String, Integer>(); for (final XmlTag subTag : tag.getSubTags()) { String name = subTag.getName(); Integer i = indices.get(name); i = i == null ? 0 : i + 1; visitXmlElement(subTag, stub, i); indices.put(name, i); } } else if (element instanceof XmlAttribute) { new AttributeStub(parent, StringRef.fromString(((XmlAttribute)element).getLocalName()), StringRef.fromNullableString(nsKey), ((XmlAttribute)element).getValue()); } }
@Stubbed GenericDomValue<String> getId();
@Stubbed List<GenericDomValue<String>> getLists();
@Stubbed List<Bar> getBars();
@Stubbed GenericAttributeValue<String> getString();
@Stubbed GenericAttributeValue<Integer> getInt();
@Stubbed @Attribute("class") GenericAttributeValue<PsiClass> getClazz();
@NotNull @Stubbed @NameValue GenericAttributeValue<String> getValue();
@NotNull @Stubbed @SubTagList("extensionPoint") List<ExtensionPoint> getExtensionPoints();
@NotNull @Stubbed List<Action> getActions();
@NotNull @Stubbed List<Group> getGroups();
@NotNull @Override protected Boolean compute() { return myType instanceof Class && DomReflectionUtil.findAnnotationDFS((Class)myType, Stubbed.class) != null || getAnnotation(Stubbed.class) != null; }
void visitXmlElement(XmlElement element, ElementStub parent, int index) { DomInvocationHandler handler = myManager.getDomHandler(element); if(handler == null || handler.getAnnotation(Stubbed.class) == null && !handler.getChildDescription().isStubbed()) { return; } AbstractDomChildrenDescription description = handler.getChildDescription(); String nsKey = description instanceof DomChildrenDescription ? ((DomChildrenDescription) description).getXmlName().getNamespaceKey() : ""; if(element instanceof XmlTag) { XmlTag tag = (XmlTag) element; String elementClass = null; if(handler.getAnnotation(StubbedOccurrence.class) != null) { final Type type = description.getType(); elementClass = ((Class) type).getName(); } ElementStub stub = new ElementStub(parent, StringRef.fromString(tag.getName()), StringRef.fromNullableString(nsKey), index, description instanceof CustomDomChildrenDescription, elementClass == null ? null : StringRef.fromNullableString(elementClass)); for(XmlAttribute attribute : tag.getAttributes()) { visitXmlElement(attribute, stub, 0); } Map<String, Integer> indices = new HashMap<String, Integer>(); for(final XmlTag subTag : tag.getSubTags()) { String name = subTag.getName(); Integer i = indices.get(name); i = i == null ? 0 : i + 1; visitXmlElement(subTag, stub, i); indices.put(name, i); } } else if(element instanceof XmlAttribute) { new AttributeStub(parent, StringRef.fromString(((XmlAttribute) element).getLocalName()), StringRef.fromNullableString(nsKey), ((XmlAttribute) element).getValue()); } }
/** * Returns the value of the code child. * <pre> * <h3>Attribute null:code documentation</h3> * The unique code of this type. * </pre> * * @return the value of the code child. */ @NotNull @com.intellij.util.xml.Attribute("code") @Required @Stubbed @NameValue GenericAttributeValue<String> getCode();
/** * Returns the value of the servlet-name child. * <pre> * <h3>Type http://java.sun.com/xml/ns/javaee:servlet-nameType documentation</h3> * The servlet-name element contains the canonical name of the * servlet. Each servlet name is unique within the web * application. * </pre> * * @return the value of the servlet-name child. */ @NameValue @Convert(ClassMappingNameConverter.class) @NotNull @Required @Stubbed GenericDomValue<String> getServletName();
/** * Returns the value of the servlet-class child. * <pre> * <h3>Element http://java.sun.com/xml/ns/javaee:servlet-class documentation</h3> * The servlet-class element contains the fully * qualified class name of the servlet. * </pre> * <pre> * <h3>Type http://java.sun.com/xml/ns/javaee:fully-qualified-classType documentation</h3> * The elements that use this type designate the name of a * Java class or interface. The name is in the form of a * "binary name", as defined in the JLS. This is the form * of name used in Class.forName(). Tools that need the * canonical name (the name used in source code) will need * to convert this binary name to the canonical name. * </pre> * * @return the value of the servlet-class child. */ @ExtendClass("javax.servlet.Servlet") @ClassTemplate(J2EEFileTemplateNames.SERVLET_CLASS_TEMPLATE) @MappingClass @NotNull @Stubbed GenericDomValue<PsiClass> getServletClass();
/** * Returns the value of the name child. * <pre> * <h3>Attribute null:name documentation</h3> * Defines the name of this group. Only for structural purpose, will have no effect on runtime. Default is empty. * </pre> * * @return the value of the name child. */ @NotNull @com.intellij.util.xml.Attribute("name") @Stubbed GenericAttributeValue<String> getName();
/** * Returns the value of the version child. * @return the value of the version child. */ @NotNull @Stubbed GenericAttributeValue<WebAppVersion> getVersion();
/** * Returns the list of context-param children. * <pre> * <h3>Element http://java.sun.com/xml/ns/javaee:context-param documentation</h3> * The context-param element contains the declaration * of a web application's servlet context * initialization parameters. * </pre> * @return the list of context-param children. */ @Stubbed List<ParamValue> getContextParams();
/** * Returns the list of filter children. * @return the list of filter children. */ @Stubbed List<Filter> getFilters();
/** * Returns the list of listener children. * @return the list of listener children. */ @Stubbed List<Listener> getListeners();
/** * Returns the list of servlet children. * @return the list of servlet children. */ @Stubbed List<Servlet> getServlets();
/** * Returns the list of servlet-mapping children. * @return the list of servlet-mapping children. */ @Stubbed List<ServletMapping> getServletMappings();
/** * Returns the list of jsp-config children. * @return the list of jsp-config children. */ @Stubbed List<JspConfig> getJspConfigs();
/** * Returns the list of security-role children. * @return the list of security-role children. */ @Stubbed List<SecurityRole> getSecurityRoles();
/** * Returns the list of jsp-property-group children. * @return the list of jsp-property-group children. */ @Stubbed List<JspPropertyGroup> getJspPropertyGroups();
/** * Returns the list of init-param children. * * @return the list of init-param children. */ @Stubbed List<InitParam> getInitParams();
/** * Returns the list of url-pattern children. * <pre> * <h3>Type http://java.sun.com/xml/ns/javaee:url-patternType documentation</h3> * The url-patternType contains the url pattern of the mapping. * It must follow the rules specified in Section 11.2 of the * Servlet API Specification. This pattern is assumed to be in * URL-decoded form and must not contain CR(#xD) or LF(#xA). * If it contains those characters, the container must inform * the developer with a descriptive error message. * The container must preserve all characters including whitespaces. * </pre> * @return the list of url-pattern children. */ @NotNull @Stubbed List<GenericDomValue<String>> getUrlPatterns();
/** * Returns the value of the el-ignored child. * <pre> * <h3>Element http://java.sun.com/xml/ns/javaee:el-ignored documentation</h3> * Can be used to easily set the isELIgnored * property of a group of JSP pages. By default, the * EL evaluation is enabled for Web Applications using * a Servlet 2.4 or greater web.xml, and disabled * otherwise. * </pre> * <pre> * <h3>Type http://java.sun.com/xml/ns/javaee:true-falseType documentation</h3> * This simple type designates a boolean with only two * permissible values * - true * - false * </pre> * @return the value of the el-ignored child. */ @Stubbed GenericDomValue<Boolean> getElIgnored();
/** * Returns the value of the page-encoding child. * <pre> * <h3>Element http://java.sun.com/xml/ns/javaee:page-encoding documentation</h3> * The valid values of page-encoding are those of the * pageEncoding page directive. It is a * translation-time error to name different encodings * in the pageEncoding attribute of the page directive * of a JSP page and in a JSP configuration element * matching the page. It is also a translation-time * error to name different encodings in the prolog * or text declaration of a document in XML syntax and * in a JSP configuration element matching the document. * It is legal to name the same encoding through * mulitple mechanisms. * </pre> * <pre> * <h3>Type http://java.sun.com/xml/ns/javaee:string documentation</h3> * This is a special string datatype that is defined by Java EE as * a base type for defining collapsed strings. When schemas * require trailing/leading space elimination as well as * collapsing the existing whitespace, this base type may be * used. * </pre> * @return the value of the page-encoding child. */ @Stubbed GenericDomValue<String> getPageEncoding();
/** * Returns the list of include-prelude children. * <pre> * <h3>Element http://java.sun.com/xml/ns/javaee:include-prelude documentation</h3> * The include-prelude element is a context-relative * path that must correspond to an element in the * Web Application. When the element is present, * the given path will be automatically included (as * in an include directive) at the beginning of each * JSP page in this jsp-property-group. * </pre> * <pre> * <h3>Type http://java.sun.com/xml/ns/javaee:pathType documentation</h3> * The elements that use this type designate either a relative * path or an absolute path starting with a "/". * In elements that specify a pathname to a file within the * same Deployment File, relative filenames (i.e., those not * starting with "/") are considered relative to the root of * the Deployment File's namespace. Absolute filenames (i.e., * those starting with "/") also specify names in the root of * the Deployment File's namespace. In general, relative names * are preferred. The exception is .war files where absolute * names are preferred for consistency with the Servlet API. * </pre> * @return the list of include-prelude children. */ @Convert(value = StaticPathReferenceConverter.class) @Stubbed List<GenericDomValue<PathReference>> getIncludePreludes();
/** * Returns the list of include-coda children. * <pre> * <h3>Element http://java.sun.com/xml/ns/javaee:include-coda documentation</h3> * The include-coda element is a context-relative * path that must correspond to an element in the * Web Application. When the element is present, * the given path will be automatically included (as * in an include directive) at the end of each * JSP page in this jsp-property-group. * </pre> * <pre> * <h3>Type http://java.sun.com/xml/ns/javaee:pathType documentation</h3> * The elements that use this type designate either a relative * path or an absolute path starting with a "/". * In elements that specify a pathname to a file within the * same Deployment File, relative filenames (i.e., those not * starting with "/") are considered relative to the root of * the Deployment File's namespace. Absolute filenames (i.e., * those starting with "/") also specify names in the root of * the Deployment File's namespace. In general, relative names * are preferred. The exception is .war files where absolute * names are preferred for consistency with the Servlet API. * </pre> * @return the list of include-coda children. */ @Convert(value = StaticPathReferenceConverter.class) @Stubbed List<GenericDomValue<PathReference>> getIncludeCodas();
/** * Returns the value of the listener-class child. * <pre> * <h3>Element http://java.sun.com/xml/ns/javaee:listener-class documentation</h3> * The listener-class element declares a class in the * application must be registered as a web * application listener bean. The value is the fully * qualified classname of the listener class. * </pre> * <pre> * <h3>Type http://java.sun.com/xml/ns/javaee:fully-qualified-classType documentation</h3> * The elements that use this type designate the name of a * Java class or interface. The name is in the form of a * "binary name", as defined in the JLS. This is the form * of name used in Class.forName(). Tools that need the * canonical name (the name used in source code) will need * to convert this binary name to the canonical name. * </pre> * @return the value of the listener-class child. */ @NotNull @ClassTemplate(J2EEFileTemplateNames.LISTENER_CLASS_TEMPLATE) @NameValue @Stubbed GenericDomValue<PsiClass> getListenerClass();