Class/Object

razie

XP

Related Docs: object XP | package razie

Permalink

case class XP[T](gp: GPath) extends Product with Serializable

a simple resolver for x path like stuff. note the limitation at the bottom

can resolve the following expressions

/a/b/c /a/b/@c /a/b[cond]/... /a/{assoc}b[cond]/...

/ a / * / c - ignore one level: explore all possibilities for just that level

One difference from classic xpath is that the root node can be specified, see "a" above

It also differs from a classic xpath by having the {assoc} option. Useful when navigating models that use assocations as well as composition (graphs). Using "/a/{assoc}b" means that it will use association {assoc} to find the b starting from a...

TODO the type system here is all gefuckt...need better understanding of variance in scala. See this http://www.nabble.com/X-String--is-not-a-subtype-of-X-AnyRef--td23428970.html

Example usage:

NOTE - this is stateless with respect to the parsed object tree - it only keeps the pre-compiled xpath expression so you should reuse them as much as possible

Note that this is a limited play-type thing. There are full XPATH implementations to browse stuff, like Apache's JXpath.

The main features of this implementation are: 1) small and embeddable 2) works for most every-day things and 3) extensiblity: you can easily plugin resolvers.

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. XP
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new XP(gp: GPath)

    Permalink

Type Members

  1. type LCC = List[Any]

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  8. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  9. val gp: GPath

    Permalink
  10. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  12. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  13. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  15. def using(ctx: XpSolver[T]): XPSolved[T]

    Permalink

    if you'll keep using the same context there's no point dragging it around

  16. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. def xpa(ctx: XpSolver[T], root: T): String

    Permalink

    return the matching attribute - solve this path starting with the root and the given solving strategy

  20. def xpe(ctx: XpSolver[T], root: T): T

    Permalink

    return the matching single element - solve this path starting with the root and the given solving strategy

  21. def xpl(ctx: XpSolver[T], root: T): List[T]

    Permalink

    return the matching list - solve this path starting with the root and the given solving strategy

  22. def xpla(ctx: XpSolver[T], root: T): List[String]

    Permalink

    return the list of matching attributes - solve this path starting with the root and the given solving strategy

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped