当前位置: 首页>>代码示例>>Java>>正文


Java JcrParentNode类代码示例

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


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

示例1: findParentField

import org.jcrom.annotations.JcrParentNode; //导入依赖的package包/类
Field findParentField(Object obj) {
    return findAnnotatedField(obj, JcrParentNode.class);
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:4,代码来源:Mapper.java

示例2: findParentField

import org.jcrom.annotations.JcrParentNode; //导入依赖的package包/类
Field findParentField(Object obj)
{
    return findAnnotatedField(obj, JcrParentNode.class);
}
 
开发者ID:sbrinkmann,项目名称:jcrom-extended,代码行数:5,代码来源:Mapper.java

示例3: resolveParentObject

import org.jcrom.annotations.JcrParentNode; //导入依赖的package包/类
private Object resolveParentObject(Field field, Node node) throws RepositoryException
{
    JcrParentNode jcrParentNode = getJcrom().getAnnotationReader().getAnnotation(field, JcrParentNode.class);
    int relativeParentLevel = jcrParentNode.relativeParentLevel();
    int absoluteParentLevel = jcrParentNode.absoluteParentLevel();
    boolean relativeParentLevelDefined = JcrParentNode.DEFAULT_VALUE_PARENT_LEVEL != relativeParentLevel;
    boolean absoluteParentLevelDefined = JcrParentNode.DEFAULT_VALUE_PARENT_LEVEL != absoluteParentLevel;

    Node resolvedParentNode = null;

    if (!JcrParentNode.DEFAULT_PARENT_PATH.equals(jcrParentNode.relativeParentPath()))
    {
        if (node.hasNode(jcrParentNode.relativeParentPath()))
        {
            resolvedParentNode = node.getNode(jcrParentNode.relativeParentPath());
        }
        else
        {
            LOG.debug("No node can be resolved with the relative path [{}] from the path [{}]", jcrParentNode.relativeParentPath(), node.getPath());
        }
    }
    else if (relativeParentLevelDefined && absoluteParentLevelDefined)
    {
        throw new JcrParameterException("For field [" + field.getName() + "] of class [" + field.getDeclaringClass().getCanonicalName()
                + "] the parameters 'relativeParentLevel' as well as 'absoluteParentLevel' are defined but they are mutually exclusive to each other.");
    }
    else if (relativeParentLevelDefined && absoluteParentLevel < node.getDepth())
    {
        resolvedParentNode = node;
        for (int i = 0; i < relativeParentLevel; i++)
        {
            resolvedParentNode = resolvedParentNode.getParent();
        }
    }
    else if (absoluteParentLevelDefined && absoluteParentLevel < node.getDepth())
    {
        resolvedParentNode = node;
        for (; resolvedParentNode.getDepth() > absoluteParentLevel; resolvedParentNode = resolvedParentNode.getParent())
            ;
    }
    else
    {
        resolvedParentNode = node.getParent();
    }

    Object resolvedParentObject = resolvedParentNode;
    if (resolvedParentObject != null && !Node.class.equals(field.getType()))
    {
        resolvedParentObject = jcrom.fromNode(field.getType(), resolvedParentNode);
    }
    return resolvedParentObject;
}
 
开发者ID:sbrinkmann,项目名称:jcrom-extended,代码行数:53,代码来源:Mapper.java


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