• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java NullPointer类的典型用法和代码示例

java 1次浏览

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

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

示例1: getPointerByID

点赞 2

import org.apache.commons.jxpath.ri.model.beans.NullPointer; //导入依赖的package包/类
/**
 * Locates a node by ID.
 * @param context starting context
 * @param id to find
 * @return Pointer
 */
public Pointer getPointerByID(JXPathContext context, String id) {
    Document document = node.getNodeType() == Node.DOCUMENT_NODE ? (Document) node
            : node.getOwnerDocument();
    Element element = document.getElementById(id);
    return element == null ? (Pointer) new NullPointer(getLocale(), id)
            : new DOMNodePointer(element, getLocale(), id);
}
 

开发者ID:convertigo,
项目名称:convertigo-engine,
代码行数:14,
代码来源:DOMNodePointer.java

示例2: getPointerByID

点赞 2

import org.apache.commons.jxpath.ri.model.beans.NullPointer; //导入依赖的package包/类
/**
 * {@inheritDoc}. Find a const's id.
 */
@Override
public Pointer getPointerByID(JXPathContext xpc, String id) {

	Object value = getConst(id, true);
	if (value == null) {
		return new NullPointer(null, id);
	} else {
		return new BeanPointerFactory().createNodePointer(null, value, null);
		// return new BeanPointer(null, value,
		// JXPathIntrospector.getBeanInfo(value.getClass()), null);
	}
}
 

开发者ID:niuxuetao,
项目名称:paxml,
代码行数:16,
代码来源:Context.java

示例3: createNodePointer

点赞 2

import org.apache.commons.jxpath.ri.model.beans.NullPointer; //导入依赖的package包/类
@Override
public NodePointer createNodePointer(final NodePointer parent, final QName name, final Object bean) {
    if (bean == null)
        return new NullPointer(parent, name);

    final JXPathBeanInfo bi = JXPathIntrospector.getBeanInfo(bean.getClass());
    return new BeanPointerEx(parent, name, bean, bi);
}
 

开发者ID:sebthom,
项目名称:oval,
代码行数:9,
代码来源:ObjectGraphNavigatorJXPathImpl.java

示例4: navigateTo

点赞 2

import org.apache.commons.jxpath.ri.model.beans.NullPointer; //导入依赖的package包/类
public ObjectGraphNavigationResult navigateTo(final Object root, final String xpath) throws InvalidConfigurationException {
    Assert.argumentNotNull("root", root);
    Assert.argumentNotNull("xpath", xpath);

    try {
        final JXPathContext ctx = JXPathContext.newContext(root);
        ctx.setLenient(true); // do not throw an exception if object graph is incomplete, e.g. contains null-values

        Pointer pointer = ctx.getPointer(xpath);

        // no match found or invalid xpath
        if (pointer instanceof NullPropertyPointer || pointer instanceof NullPointer)
            return null;

        if (pointer instanceof BeanPointer) {
            final Pointer parent = ((BeanPointer) pointer).getImmediateParentPointer();
            if (parent instanceof PropertyPointer) {
                pointer = parent;
            }
        }

        if (pointer instanceof PropertyPointer) {
            final PropertyPointer pp = (PropertyPointer) pointer;
            final Class<?> beanClass = pp.getBean().getClass();
            AccessibleObject accessor = ReflectionUtils.getField(beanClass, pp.getPropertyName());
            if (accessor == null) {
                accessor = ReflectionUtils.getGetter(beanClass, pp.getPropertyName());
            }
            return new ObjectGraphNavigationResult(root, xpath, pp.getBean(), accessor, pointer.getValue());
        }

        throw new InvalidConfigurationException("Don't know how to handle pointer [" + pointer + "] of type [" + pointer.getClass().getName()
                + "] for xpath [" + xpath + "]");
    } catch (final JXPathNotFoundException ex) {
        // thrown if the xpath is invalid
        throw new InvalidConfigurationException(ex);
    }
}
 

开发者ID:sebthom,
项目名称:oval,
代码行数:39,
代码来源:ObjectGraphNavigatorJXPathImpl.java

示例5: apply

点赞 2

import org.apache.commons.jxpath.ri.model.beans.NullPointer; //导入依赖的package包/类
@Override
public boolean apply(Object input) {
    JXPathContext jxpath = JXPathContext.newContext(input);
    // We should allow non-existing path, and let predicate handle it.
    jxpath.setLenient(true);

    Pointer pointer = jxpath.getPointer(xpath);
   
    return pointer != null && !(pointer instanceof NullPointer) && pointer.getValue() != null;
}
 

开发者ID:Netflix,
项目名称:suro,
代码行数:11,
代码来源:PathExistsMessageFilter.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)