• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Filter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jdom.filter.Filter的典型用法代码示例。如果您正苦于以下问题:Java Filter类的具体用法?Java Filter怎么用?Java Filter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Filter类属于org.jdom.filter包,在下文中一共展示了Filter类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: findTypeContent

import org.jdom.filter.Filter; //导入依赖的package包/类
protected final org.jdom.Element findTypeContent(final String type, org.jdom.Element docRoot) {
    @SuppressWarnings("unchecked")
    List<org.jdom.Element> lst = docRoot.getContent(new Filter() {
        @Override
        public boolean matches(Object match) {
            if (match instanceof org.jdom.Element) {
                org.jdom.Element el = (org.jdom.Element)match;
                if ("complexType".equals(el.getName()) && type.equals(el.getAttributeValue("name"))) { //NOI18N
                    return true;
                }
            }
            return false;
        }
    });
    if (lst.size() > 0) {
        org.jdom.Element typeEl = lst.get(0);
        return typeEl.getChild("all", docRoot.getNamespace()); //NOI18N
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:AbstractSchemaBasedGrammar.java


示例2: extractXMLelement

import org.jdom.filter.Filter; //导入依赖的package包/类
/**
 * Extracts the contents of the named XML element from a parent
 *
 * @param parentElement The parent element
 * @param theElement    Name of the XML element to be extracted
 * @return
 * @throws IOException
 * @throws JDOMException
 */
public static Element extractXMLelement(Element parentElement, String theElement) throws JDOMException, IOException {

    Filter elementFilter = new ElementFilter();
    List<Element> children = parentElement.getContent(elementFilter);
    for (Element element : children) {
        if (element.getName().equalsIgnoreCase(theElement)) {
            return element;
        }
        Element child = extractXMLelement(element, theElement);
        if (child != null) {
            return child;
        }
    }
    return null;
}
 
开发者ID:opf-labs,项目名称:jhove2,代码行数:25,代码来源:PronomWebService.java


示例3: cleanTaggedValues

import org.jdom.filter.Filter; //导入依赖的package包/类
private static void cleanTaggedValues(StringBuffer xmiContents) throws IOException {
    // filter for <UML:TaggedValue ../>
    Filter taggedValueFilter = new Filter() {
        public boolean matches(Object obj) {
            if (obj instanceof Element) {
                Element elem = (Element) obj;
                if (elem.getName().equals("TaggedValue")) {
                    return elem.getAttribute("value") == null;
                }
            }
            return false;
        }
    };
    
    int removed = removeElementsByFilter(xmiContents, taggedValueFilter);
    log.debug("Removed " + removed + " TaggedValue elements");
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:18,代码来源:XmiCleaner.java


示例4: hasDocumentation

import org.jdom.filter.Filter; //导入依赖的package包/类
public boolean hasDocumentation() {
   	
	Filter filter = new DocumentationFilter();
	Iterator docIt = element.getDescendants(filter);
	if ( docIt.hasNext() ) {
		return true;
	} else {
		return false;
	}
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:11,代码来源:Container.java


示例5: getDocumentation

import org.jdom.filter.Filter; //导入依赖的package包/类
public Documentation getDocumentation () {
	Filter filter = new DocumentationFilter();
	Iterator docIt = element.getDescendants(filter);
	Element documentation = (Element) docIt.next();
	
	if ( documentation != null ) { 
		return new Documentation(documentation);
	}
	
	return null;
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:12,代码来源:Container.java


示例6: findProperty

import org.jdom.filter.Filter; //导入依赖的package包/类
public Element findProperty(Element group, String name) throws LASException {
    Filter propertyFilter = new FindPropertyFilter(name);       
    Iterator propsIt = group.getDescendants(propertyFilter);
    Element property=null;
    if ( propsIt.hasNext() ) {
        property = (Element) propsIt.next();
    }
    if ( propsIt.hasNext()) {
        throw new LASException("More than one property with same name.");
    }
    return property;  
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:13,代码来源:LASDocument.java


示例7: findPropertyGroup

import org.jdom.filter.Filter; //导入依赖的package包/类
public Element findPropertyGroup(Element properties, String group) throws LASException {
        // Finds properties below a particular element.
        Filter propertyGroupFilter = new FindPropertyGroupFilter(group);
        Iterator pgIt = properties.getDescendants(propertyGroupFilter);
        Element propGroup = null;
        if (pgIt.hasNext()) {
            propGroup = (Element) pgIt.next();
        }
//        if ( pgIt.hasNext() ) {
//            throw new LASException("More than one property group with name = "+group);
//        }
        // Just return the first...
        return propGroup;
    }
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:15,代码来源:LASDocument.java


示例8: findPropertyGroupList

import org.jdom.filter.Filter; //导入依赖的package包/类
public ArrayList<Element> findPropertyGroupList(Element element, String group) {
    ArrayList<Element> groups = new ArrayList<Element>();
    Filter propertyGroupFilter = new FindPropertyGroupFilter(group);
    for (Iterator pgIt = element.getDescendants(propertyGroupFilter); pgIt.hasNext(); ) {
        groups.add((Element)pgIt.next());
    }
    return groups;
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:9,代码来源:LASDocument.java


示例9: getCDATAExceptionStackTracesUnder

import org.jdom.filter.Filter; //导入依赖的package包/类
private List<CDATA> getCDATAExceptionStackTracesUnder(Element rootElement) {
    Iterator it = rootElement.getDescendants(new Filter() {
        public boolean matches(Object arg0) {
            return arg0 instanceof CDATA;
        }
    });
    List<CDATA> stackTraceElements = new ArrayList<CDATA>();
    while (it.hasNext()) {
        CDATA next = (CDATA) it.next();
        stackTraceElements.add(next);
    }
    return stackTraceElements;
}
 
开发者ID:BradNeuberg,项目名称:purple-include,代码行数:14,代码来源:FarmServerConfigurationActionTest.java


示例10: cleanUmlDiagrams

import org.jdom.filter.Filter; //导入依赖的package包/类
private static void cleanUmlDiagrams(StringBuffer xmiContents) throws IOException {
    // filter for <UML:Diagram ../>
    Filter diagramFilter = new Filter() {
        public boolean matches(Object obj) {
            if (obj instanceof Element) {
                Element elem = (Element) obj;
                return elem.getName().equals("Diagram");
            }
            return false;
        }
    };
    
    int removed = removeElementsByFilter(xmiContents, diagramFilter);
    log.debug("Removed " + removed + " Diagram elements");
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:16,代码来源:XmiCleaner.java


示例11: checkDefaultPredicates

import org.jdom.filter.Filter; //导入依赖的package包/类
public static CQLQuery checkDefaultPredicates(CQLQuery original) throws Exception {
    LOG.debug("Checking query for Attributes with no predicate defined");
    StringWriter originalWriter = new StringWriter();
    Utils.serializeObject(original, DataServiceConstants.CQL_QUERY_QNAME, originalWriter);
    Element root = XMLUtilities.stringToDocument(originalWriter.getBuffer().toString()).getRootElement();
    Filter attributeNoPredicateFilter = new Filter() {
        public boolean matches(Object o) {
            if (o instanceof Element) {
                Element e = (Element) o;
                if (e.getName().equals("Attribute") && e.getAttribute("predicate") == null) {
                    return true;
                }
            }
            return false;
        }
    };
    List<?> attributesWithNoPredicate = root.getContent(attributeNoPredicateFilter);
    Iterator<?> attribIter = attributesWithNoPredicate.iterator();
    while (attribIter.hasNext()) {
        LOG.debug("Adding default predicate to an attribute");
        Element elem = (Element) attribIter.next();
        elem.setAttribute("predicate", "EQUAL_TO");
    }
    String xml = XMLUtilities.elementToString(root);
    CQLQuery edited = Utils.deserializeObject(new StringReader(xml), CQLQuery.class);
    return edited;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:28,代码来源:CQLAttributeDefaultPredicateUtil.java


示例12: getContent

import org.jdom.filter.Filter; //导入依赖的package包/类
@Override
public <T extends Content> List<T> getContent(final Filter<T> filter) {
  return (List<T>)ContainerUtil.filter(myContent, new Condition<Content>() {
    @Override
    public boolean value(Content content) {
      return filter.matches(content);
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:ImmutableElement.java


示例13: addHttpsConnector

import org.jdom.filter.Filter; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "serial", "rawtypes" })
private void addHttpsConnector(String keyStorePassword,
		File keyStoreLocation, Element serverElement) throws IOException,
		ContainerException {
	Iterator httpsConnectorElements = serverElement.getDescendants(new Filter() {
        public boolean matches(Object o) {
            if (o instanceof Element) {
                Element e = (Element) o;
                if (e.getName().equals("Connector")) {
                	if(e.getAttribute("schema")!=null && "https".equals(e.getAttribute("schema").getValue())){
                		return true;
                	}
                }
            }
            return false;
        }
    });
    // verify there is only one connector
    if (!httpsConnectorElements.hasNext()) {
    	Element service=(Element)serverElement.getChildren("Service").get(0);

    	Element connector = new Element("Connector");
	    connector.setAttribute(new Attribute("acceptCount", "100"));
	    connector.setAttribute(new Attribute("clientAuth", "false"));
	    connector.setAttribute(new Attribute("debug", "0"));
	    connector.setAttribute(new Attribute("disableUploadTimeout", "true"));
	    connector.setAttribute(new Attribute("enableLookups", "false"));
	    connector.setAttribute(new Attribute("keystoreFile", keyStoreLocation.getCanonicalPath()));
	    connector.setAttribute(new Attribute("keystorePass", keyStorePassword));
	    connector.setAttribute(new Attribute("maxHttpHeaderSize", "8192"));
	    connector.setAttribute(new Attribute("maxSpareThreads", "75"));
	    connector.setAttribute(new Attribute("maxThreads", "150"));
	    connector.setAttribute(new Attribute("minSpareThreads", "25"));
	    connector.setAttribute(new Attribute("port", ""+httpsPortNumber));
	    connector.setAttribute(new Attribute("schema", "https"));
	    connector.setAttribute(new Attribute("secure", "true"));
	    connector.setAttribute(new Attribute("sslProtocol", "TLS"));
	    
	    service.getChildren().add(connector);
    }else{
        throw new ContainerException("More than one HTTPS connector was found in the server configuration!");
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:44,代码来源:ChangeTomcatServerConfigurationStep.java


示例14: startFixing

import org.jdom.filter.Filter; //导入依赖的package包/类
public void startFixing() {
    List<File> classpathFiles = recursiveListFiles(new File(baseSearchDir),
        new FileFilter() {
            
            public boolean accept(File pathname) {
                return pathname.getName().equals(".classpath");
            }
        });
    for (File f : classpathFiles) {
        if (f.isFile()) {
            System.out.println("Working on " + f.getAbsolutePath());
            try {
                Document doc = fileToDocument(f);
                List libElements = doc.getRootElement().getContent(new Filter() {
                    public boolean matches(Object o) {
                        if (o instanceof Element) {
                            Element e = (Element) o;
                            if (e.getName().equals("classpathentry") &&
                                "lib".equals(e.getAttributeValue("kind"))) {
                                return true;
                            }
                        }
                        return false;
                    }
                });
                Iterator libElemIter = libElements.iterator();
                while (libElemIter.hasNext()) {
                    Element entryElem = (Element) libElemIter.next();
                    File projectBase = f.getParentFile();
                    String libPath = entryElem.getAttributeValue("path");
                    File libFile = new File(projectBase, libPath);
                    String libName = libFile.getName();
                    if (libName.startsWith("caGrid-") && libName.endsWith("-1.6-dev.jar")) {
                        System.out.println("Found a library to fix up ("  + libPath + ")");
                        int endIndex = libPath.lastIndexOf("-1.6-dev.jar");
                        libPath = libPath.substring(0, endIndex);
                        libPath += "-1.4.jar";
                        System.out.println("\tFixed up to " + libPath);
                        entryElem.setAttribute("path", libPath);
                    }
                }
                saveDocument(doc, f);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:49,代码来源:ClasspathFixer.java


示例15: getDescendants

import org.jdom.filter.Filter; //导入依赖的package包/类
@Override
public <T extends Content> Iterator<T> getDescendants(Filter<T> filter) {
  throw immutableError(this);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:ImmutableElement.java


示例16: removeContent

import org.jdom.filter.Filter; //导入依赖的package包/类
@Override
public <T extends Content> List<T> removeContent(Filter<T> filter) {
  throw immutableError(this);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:ImmutableElement.java


示例17: getContent

import org.jdom.filter.Filter; //导入依赖的package包/类
/**
 * Returns as a {@link java.util.List} the content of
 * this parent that matches the supplied filter. The returned list is
 * <b>"live"</b> and in document order. Any modifications to it affect
 * the element's actual contents. Modifications are checked for
 * conformance to XML 1.0 rules.
 * <p>
 * Sequential traversal through the List is best done with an Iterator
 * since the underlying implement of {@link java.util.List#size} may
 * require walking the entire list and indexed lookups may require
 * starting at the beginning each time.
 *
 * @param  filter filter to apply
 * @return a list of the content of the parent matching the filter
 * @throws IllegalStateException if parent is a Document
 *         and the root element is not set
 */
List getContent(Filter filter);
 
开发者ID:AMPBEdu,项目名称:gjOryx,代码行数:19,代码来源:Parent.java


示例18: removeContent

import org.jdom.filter.Filter; //导入依赖的package包/类
/**
 * Removes from this parent all child content matching the given filter
 * and returns a list of the detached children.
 *
 * @param  filter filter to apply
 * @return list of the detached children matching the filter
 */
List removeContent(Filter filter);
 
开发者ID:AMPBEdu,项目名称:gjOryx,代码行数:9,代码来源:Parent.java


示例19: getDescendants

import org.jdom.filter.Filter; //导入依赖的package包/类
/**
 * Returns an {@link java.util.Iterator} that walks over all descendants
 * in document order applying the Filter to return only elements that
 * match the filter rule.  With filters you can match only Elements,
 * only Comments, Elements or Comments, only Elements with a given name
 * and/or prefix, and so on.
 *
 * @param filter filter to select which descendants to see
 * @return an iterator to walk descendants that match a filter
 */
Iterator getDescendants(Filter filter);
 
开发者ID:AMPBEdu,项目名称:gjOryx,代码行数:12,代码来源:Parent.java



注:本文中的org.jdom.filter.Filter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PieSectionLabelGenerator类代码示例发布时间:2022-05-21
下一篇:
Java LongOpenHashSet类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap