Tabnine Logo
JXPathIntrospector
Code IndexAdd Tabnine to your IDE (free)

How to use
JXPathIntrospector
in
org.apache.commons.jxpath

Best Java code snippets using org.apache.commons.jxpath.JXPathIntrospector (Showing top 20 results out of 315)

origin: commons-jxpath/commons-jxpath

public NodePointer createNodePointer(QName name, Object bean, Locale locale) {
  JXPathBeanInfo bi = JXPathIntrospector.getBeanInfo(bean.getClass());
  return new BeanPointer(name, bean, bi, locale);
}
origin: geotools/geotools

  protected boolean stream(ElementHandler handler) {
    // create an xpath context from the root element
    // TODO: cache the context, should work just the same
    //        JXPathIntrospector.registerDynamicClass(ElementHandlerImpl.class,
    //            ElementHandlerPropertyHandler.class);
    JXPathIntrospector.registerDynamicClass(NodeImpl.class, NodePropertyHandler.class);

    //        ElementHandler rootHandler =
    //        	((DocumentHandler) handlers.firstElement()).getDocumentElementHandler();
    Node root = ((DocumentHandler) handlers.firstElement()).getParseNode();
    JXPathContext jxpContext = JXPathContextFactory.newInstance().newContext(null, root);

    jxpContext.setLenient(true);

    Iterator itr = jxpContext.iterate(xpath);

    while (itr.hasNext()) {
      Object obj = itr.next();

      if (handler.getParseNode().equals(obj)) {
        return true;
      }
    }

    return false;
  }
}
origin: commons-jxpath/commons-jxpath

/**
 * Creates and registers a JXPathBeanInfo object for the supplied class. If
 * the class has already been registered, returns the registered
 * JXPathBeanInfo object.
 * <p>
 * The process of creation of JXPathBeanInfo is as follows:
 * <ul>
 * <li>If class named <code>&lt;beanClass&gt;XBeanInfo</code> exists,
 *     an instance of that class is allocated.
 * <li>Otherwise, an instance of {@link JXPathBasicBeanInfo
 *     JXPathBasicBeanInfo}  is allocated.
 * </ul>
 * @param beanClass whose info to get
 * @return JXPathBeanInfo
 */
public static JXPathBeanInfo getBeanInfo(Class beanClass) {
  JXPathBeanInfo beanInfo = (JXPathBeanInfo) byClass.get(beanClass);
  if (beanInfo == null) {
    beanInfo = findDynamicBeanInfo(beanClass);
    if (beanInfo == null) {
      beanInfo = findInformant(beanClass);
      if (beanInfo == null) {
        beanInfo = new JXPathBasicBeanInfo(beanClass);
      }
    }
    byClass.put(beanClass, beanInfo);
  }
  return beanInfo;
}
origin: commons-jxpath/commons-jxpath

/**
 * find a JXPathBeanInfo instance for the specified class.
 * Similar to javax.beans property handler discovery; search for a
 * class with "XBeanInfo" appended to beanClass.name, then check
 * whether beanClass implements JXPathBeanInfo for itself.
 * Invokes the default constructor for any class it finds.
 * @param beanClass for which to look for an info provider
 * @return JXPathBeanInfo instance or null if none found
 */
private static synchronized JXPathBeanInfo findInformant(Class beanClass) {
  String name = beanClass.getName() + "XBeanInfo";
  try {
    return (JXPathBeanInfo) instantiate(beanClass, name);
  }
  catch (Exception ex) { //NOPMD
    // Just drop through
  }
  // Now try checking if the bean is its own JXPathBeanInfo.
  try {
    if (JXPathBeanInfo.class.isAssignableFrom(beanClass)) {
      return (JXPathBeanInfo) beanClass.newInstance();
    }
  }
  catch (Exception ex) { //NOPMD
    // Just drop through
  }
  return null;
}
origin: commons-jxpath/commons-jxpath

if (interfaces != null) {
  for (int i = 0; i < interfaces.length; i++) {
    beanInfo = findDynamicBeanInfo(interfaces[i]);
    if (beanInfo != null && beanInfo.isDynamic()) {
      return beanInfo;
    return beanInfo;
  return findDynamicBeanInfo(sup);
origin: jp.terasoluna.fw/terasoluna-commons

/**
 * ノードポインタを生成する。
 * @param name QName
 * @param bean ターゲットとなるBean
 * @param locale ロケール
 * @return Beanポインタ
 */
@Override
public NodePointer createNodePointer(
  QName name, Object bean, Locale locale) {
  JXPathBeanInfo bi = JXPathIntrospector.getBeanInfo(bean.getClass());
  return new BeanPointerEx(name, bean, bi, locale);
}
origin: org.geotools/gt2-xml-core

  protected boolean stream(ElementHandler handler) {
    //create an xpath context from the root element
    // TODO: cache the context, should work just the same
    //        JXPathIntrospector.registerDynamicClass(ElementHandlerImpl.class,
    //            ElementHandlerPropertyHandler.class);
    JXPathIntrospector.registerDynamicClass(NodeImpl.class, NodePropertyHandler.class);

    //        ElementHandler rootHandler = 
    //        	((DocumentHandler) handlers.firstElement()).getDocumentElementHandler();
    Node root = ((DocumentHandler) handlers.firstElement()).getParseNode();
    JXPathContext jxpContext = JXPathContextFactory.newInstance().newContext(null, root);

    jxpContext.setLenient(true);

    Iterator itr = jxpContext.iterate(xpath);

    for (; itr.hasNext();) {
      Object obj = itr.next();

      if (handler.getParseNode().equals(obj)) {
        return true;
      }
    }

    return false;
  }
}
origin: commons-jxpath/commons-jxpath

public boolean isLeaf() {
  Object value = getNode();
  return value == null || JXPathIntrospector.getBeanInfo(value.getClass()).isAtomic();
}
origin: org.geotools.xsd/gt-core

  protected boolean stream(ElementHandler handler) {
    //create an xpath context from the root element
    // TODO: cache the context, should work just the same
    //        JXPathIntrospector.registerDynamicClass(ElementHandlerImpl.class,
    //            ElementHandlerPropertyHandler.class);
    JXPathIntrospector.registerDynamicClass(NodeImpl.class, NodePropertyHandler.class);

    //        ElementHandler rootHandler = 
    //        	((DocumentHandler) handlers.firstElement()).getDocumentElementHandler();
    Node root = ((DocumentHandler) handlers.firstElement()).getParseNode();
    JXPathContext jxpContext = JXPathContextFactory.newInstance().newContext(null, root);

    jxpContext.setLenient(true);

    Iterator itr = jxpContext.iterate(xpath);

    for (; itr.hasNext();) {
      Object obj = itr.next();

      if (handler.getParseNode().equals(obj)) {
        return true;
      }
    }

    return false;
  }
}
origin: commons-jxpath/commons-jxpath

public boolean isLeaf() {
  Object value = getNode();
  return value == null
    || JXPathIntrospector.getBeanInfo(value.getClass()).isAtomic();
}
origin: org.geotools/gt2-xml-xsd

  protected boolean stream(ElementHandler handler) {
    //create an xpath context from the root element
    // TODO: cache the context, should work just the same
//        JXPathIntrospector.registerDynamicClass(ElementHandlerImpl.class,
//            ElementHandlerPropertyHandler.class);
    JXPathIntrospector.registerDynamicClass( NodeImpl.class, NodePropertyHandler.class );

//        ElementHandler rootHandler = 
//            ((DocumentHandler) handlers.firstElement()).getDocumentElementHandler();
    
    Node root = ((DocumentHandler)handlers.firstElement()).getParseNode();
    JXPathContext jxpContext = 
      JXPathContextFactory.newInstance().newContext(null,root);
        
    jxpContext.setLenient(true);

    Iterator itr = jxpContext.iterate(xpath);

    for (; itr.hasNext();) {
      Object obj = itr.next();
      if (handler.getParseNode().equals(obj)) {
        return true;
      }
    }
  
    return false;
  }
  
origin: org.eclipse.platform/org.eclipse.e4.emf.xpath

@Override
public boolean isLeaf() {
  Object value = getNode();
  return value == null
    || JXPathIntrospector.getBeanInfo(value.getClass()).isAtomic();
}
origin: org.apache.cocoon/cocoon-flowscript-impl

public void initialize() throws Exception {
  if (enableDebugger) {
    if (getLogger().isDebugEnabled()) {
      getLogger().debug("Flow debugger enabled, creating");
    }
    getDebugger().doBreak();
  }
  Context context = Context.enter();
  context.setOptimizationLevel(OPTIMIZATION_LEVEL); 
  context.setCompileFunctionsWithDynamicScope(true);
  context.setGeneratingDebug(true);
  // add support for Rhino objects to JXPath
  JXPathIntrospector.registerDynamicClass(Scriptable.class,
                      ScriptablePropertyHandler.class);
  JXPathContextReferenceImpl.addNodePointerFactory(new ScriptablePointerFactory());
  try {
    scope = new Global(context);
    // Access to Cocoon internal objects
    FOM_Cocoon.init(scope);
  } catch (Exception e) {
    Context.exit();
    throw e;
  }
}
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.e4.emf.xpath

@Override
public boolean isLeaf() {
  Object value = getNode();
  return value == null || JXPathIntrospector.getBeanInfo(value.getClass()).isAtomic();
}
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.e4.emf.xpath

@Override
public boolean isLeaf() {
  Object value = getNode();
  return value == null || JXPathIntrospector.getBeanInfo(value.getClass()).isAtomic();
}
origin: org.eclipse.platform/org.eclipse.e4.emf.xpath

@Override
public boolean isLeaf() {
  Object value = getNode();
  return value == null || JXPathIntrospector.getBeanInfo(value.getClass()).isAtomic();
}
origin: commons-jxpath/commons-jxpath

public boolean isLeaf() {
  Object value = getNode();
  return value == null || JXPathIntrospector.getBeanInfo(value.getClass()).isAtomic();
}
origin: commons-jxpath/commons-jxpath

  public NodePointer createNodePointer(NodePointer parent, QName name,
      Object bean) {
    if (bean == null) {
      return new NullPointer(parent, name);
    }

    JXPathBeanInfo bi = JXPathIntrospector.getBeanInfo(bean.getClass());
    return new BeanPointer(parent, name, bean, bi);
  }
}
origin: org.apache.cocoon/cocoon-sitemap-impl

  public static Iterator getAttributeNames(JXPathHelperConfiguration setup, Object contextObj)
  throws ConfigurationException {

    if (contextObj == null) {
      return null;
    }

    try {
      JXPathBeanInfo info = JXPathIntrospector.getBeanInfo(contextObj.getClass());
      java.beans.PropertyDescriptor[] properties = info.getPropertyDescriptors();

      List names = new LinkedList();
      for (int i = 0; i < properties.length; i++) {
        names.add(properties[i].getName());
      }

      return names.listIterator();
    } catch (Exception e) {
      throw new ConfigurationException("Error retrieving attribute names for class: " + contextObj.getClass(), e);
    }
  }
}
origin: commons-jxpath/commons-jxpath

public boolean isLeaf() {
  Object value = getNode();
  return value == null || JXPathIntrospector.getBeanInfo(value.getClass()).isAtomic();
}
org.apache.commons.jxpathJXPathIntrospector

Javadoc

JXPathIntrospector maintains a registry of JXPathBeanInfo objects for Java classes.

Most used methods

  • getBeanInfo
    Creates and registers a JXPathBeanInfo object for the supplied class. If the class has already been
  • registerDynamicClass
    Automatically creates and registers a JXPathBeanInfo object for the specified class. That object ret
  • findDynamicBeanInfo
    Find a dynamic bean info if available for any superclasses or interfaces.
  • findInformant
    find a JXPathBeanInfo instance for the specified class. Similar to javax.beans property handler disc
  • instantiate
    Try to create an instance of a named class. First try the classloader of "sibling", then try the sys

Popular in Java

  • Updating database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • getSystemService (Context)
  • onRequestPermissionsResult (Fragment)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Collectors (java.util.stream)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now