Class

argus.macros

ASTHelpers

Related Doc: package macros

Permalink

class ASTHelpers[U <: Universe] extends AnyRef

Common utils for AST munging. Also includes a few helps for constructing type names/paths from json constructs.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ASTHelpers
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ASTHelpers(u: U)

    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. val RefNameExtractor: Regex

    Permalink
  5. val RefPathExtractor: Regex

    Permalink
  6. final def asInstanceOf[T0]: T0

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def collectExtendsType(path: List[String], typ: U.Tree, defs: List[U.Tree]): List[(List[String], U.Tree)]

    Permalink

    Collects and returns case classes that extend the given type.

    Collects and returns case classes that extend the given type.

    returns

    A list of tuples. Each tuple contains the path, and class def

  9. def companionForType(typ: U.Tree): U.Tree

    Permalink

    For a given type (optional including it's path) returns it's companion object

  10. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  12. def extractPathFromRef(rootName: Option[String], ref: String): List[String]

    Permalink

    Extracts a package path from a json-schema $ref.

    Extracts a package path from a json-schema $ref. Notes:

    • # is replaced by whatever we call the root schema
    • Definitions are defined at the same level as their containing object, i.e. for #/properties/a/definitions/Bob Bob is defined alongside A, not within it. This can be a bit confusing.
    rootName

    The name of the root class. Which is used to replace #/ references

    ref

    The $ref element to path-erize.

  13. def finalize(): Unit

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

    Permalink
    Definition Classes
    AnyRef → Any
  15. def hasAnnotation(mods: U.Modifiers, annotation: String): Boolean

    Permalink

    Returns true if the given contains the given annotation

  16. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  17. def inList(inner: U.Tree): U.Tree

    Permalink

    Wrap the given type in an List type

  18. def inOption(inner: U.Tree): U.Tree

    Permalink

    Wrap the given type in an Option type

  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. def mkSelectPath(path: List[String]): U.Tree

    Permalink

    Quasiquote doesn't support building trees of selects (i.e.

    Quasiquote doesn't support building trees of selects (i.e. obj1.obj2.MyObj), so we do it here manually.

    path

    List of strings representing the paths.

    returns

    e.g. obj1.obj2.myObj becomes: Select(Select(Ident(TermName("obj1")), TermName("obj2")), TermName("myObj"))

  21. def mkTypeSelectPath(path: List[String]): U.Tree

    Permalink

    Builds on mkSelectPath, but treats last item is a Type rather than a TermName

  22. def nameFromJson(json: String): String

    Permalink

    Best attempt at producing a name from a Json blob.

    Best attempt at producing a name from a Json blob. This is mostly used for enum, where the enum's can be any arbitrary Json structure. Mostly they are plain strings, in which case this is a no-op, but in the case where it's more complex then the property names from json structure are used to build a name. If the json object is a number then decimial points are stripped, and "n" is prefixed (i.e. 3.14 => n314).

  23. def nameFromType(typ: U.Tree, usePath: Boolean = true): String

    Permalink

    Returns a string from a given type (with path) that somewhat uniquely identifies this type.

    Returns a string from a given type (with path) that somewhat uniquely identifies this type. Can be useful for producing variable names. For example: a.b.C => ABC

    typ

    The type to produce a term from.

    usePath

    Whether to use a type's path or not. If not then only C of a.b.C is used. Defaults to true.

  24. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  27. def paramsToMap(nameAndDefaults: List[(String, Any)], params: List[U.Tree]): Map[String, Any]

    Permalink

    Extracts argument values from a List[Tree] as is obtained from a quasiquote such as q"myFunc(..$params))".

    Extracts argument values from a List[Tree] as is obtained from a quasiquote such as q"myFunc(..$params))". Supports named arguments, and default values.

    nameAndDefaults

    A list of tuples containing each argument's name and default value. This must be the complete list of supported arguments.

    params

    A list of trees to as extracted by ..$params. If arguments are constants or option wrapped constants then their reified values are returned (i.e. Some(1)), if not then the AST chunk is returned.

    returns

    A map of argument names and their extracted values (or their default value if not extracted)

  28. def selectPathToList(tree: U.Tree): List[String]

    Permalink

    Extract the select path as a List[String]

  29. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  30. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  31. def treesIntersect(l1: List[U.Tree], l2: List[U.Tree]): List[U.Tree]

    Permalink

    Returns the intersection set between two lists of trees (based on the tree's being equal in structure)

  32. def typeForCompanion(typ: U.Tree): U.Tree

    Permalink

    For a given companion object (optional including it's path) returns it's given type

  33. def typeSelectPathToList(typ: U.Tree): List[String]

    Permalink

    Extract the select path (ending with a TypeName) as a List[String].

    Extract the select path (ending with a TypeName) as a List[String]. Types with type parameters are concatenated to form a single string. For example: a.b.MyObj[A,B[C]] becomes List(a,b,MyObjABC)

  34. val u: U

    Permalink
  35. def uncapitialize(s: String): String

    Permalink
  36. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped