static {
    JXPathIntrospector.registerDynamicClass(
        NodeDefinition.class, NodeDefinitionPropertyHandler.class);
    JXPathIntrospector.registerDynamicClass(Schema.class, SchemaPropertyHandler.class);

    CONTEXT = JXPathContext.newContext(null);
  }
Ejemplo n.º 2
0
 /**
  * Recupera un nodo del arbol a partir del path de dicho nodo dentro de la jerarquia
  *
  * @param nodePath
  * @return El nodo correspondiente al path solicitado o nulo en caso de no ser un paz valido
  *     dentro de la jerarquia
  */
 public TreeNode getNode(String nodePath) {
   synchronized (this) {
     try {
       JXPathIntrospector.registerDynamicClass(TreeNode.class, TreeNodeXPathHandler.class);
       JXPathIntrospector.registerDynamicClass(TreeView.class, TreeNodeXPathHandler.class);
       JXPathContext xPathContext = JXPathContext.newContext(this);
       return (TreeNode) xPathContext.getValue(nodePath);
     } catch (Exception e) {
       return null;
     }
   }
 }
 public NodePointer createNodePointer(QName name, Object bean, Locale locale) {
   JXPathBeanInfo bi = JXPathIntrospector.getBeanInfo(bean.getClass());
   if (bi.isDynamic()) {
     DynamicPropertyHandler handler =
         ValueUtils.getDynamicPropertyHandler(bi.getDynamicPropertyHandlerClass());
     return new DynamicPointer(name, bean, handler, locale);
   }
   return null;
 }
  public NodePointer createNodePointer(NodePointer parent, QName name, Object bean) {
    if (bean == null) {
      return new NullPointer(parent, name);
    }

    JXPathBeanInfo bi = JXPathIntrospector.getBeanInfo(bean.getClass());
    if (bi.isDynamic()) {
      DynamicPropertyHandler handler =
          ValueUtils.getDynamicPropertyHandler(bi.getDynamicPropertyHandlerClass());
      return new DynamicPointer(parent, name, bean, handler);
    }
    return null;
  }