fm.serializer

MacroHelpers

abstract class MacroHelpers extends AnyRef

Self Type
MacroHelpers
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MacroHelpers
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new MacroHelpers(isDebug: Boolean)

Type Members

  1. case class FieldImpl(number: Int = -1, name: String = null, getter: String = null, setter: String = null, constructorIdx: Int = -1, serializer: Tree = null, deserializer: Tree = null, tpe: scala.reflect.macros.Universe.Type = null, defaultValue: Tree = null) extends Product with Serializable

    The companion class to Field

  2. case class JavaBeanField(name: String, getter: String, setter: String, tpe: scala.reflect.macros.Universe.Type) extends Product with Serializable

    Note: The setter is optional if the type is a java.

Abstract Value Members

  1. abstract val ctx: Context

Concrete Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def cleanFieldImpls(fields: Seq[FieldImpl]): Vector[FieldImpl]

  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def companionType(tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Type

    Given a class find the companion object

  10. def constructorWithSignature(tpe: scala.reflect.macros.Universe.Type, params: Seq[scala.reflect.macros.Universe.Type]): scala.reflect.macros.Universe.MethodSymbol

  11. def defaultValuesForMethod(tpe: scala.reflect.macros.Universe.Type, method: scala.reflect.macros.Universe.MethodSymbol): List[Option[Tree]]

    Given a type a a method of that type return the default values for the parameters of the method

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

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

    Definition Classes
    AnyRef → Any
  14. def extractFieldAnnotations(tpe: scala.reflect.macros.Universe.Type): Seq[FieldImpl]

  15. def extractFieldAnnotations[T](implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): Seq[FieldImpl]

    Extract Field annotations for a type and convert them into FieldImpls

  16. def extractSingleTypeParamAsSeenFrom(tpe: scala.reflect.macros.Universe.Type, baseType: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Type

    e.

    e.g. extractSingleTypeParamAsSeenFrom[Map[String,Int]](typeOf[TraversableOnce[_]]) => (String,Int)

  17. def extractTypeParamAsSeenFrom(tpe: scala.reflect.macros.Universe.Type, baseType: scala.reflect.macros.Universe.Type): List[scala.reflect.macros.Universe.Type]

  18. def fillInType(objTpe: scala.reflect.macros.Universe.Type, fields: Vector[FieldImpl]): Vector[FieldImpl]

  19. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def findCollectionDeserializer[T](implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): Option[scala.reflect.macros.Universe.Expr[Deserializer[T]]]

    Lookup a Collection Serializer

  21. def findCollectionSerializer[T](implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): Option[scala.reflect.macros.Universe.Expr[Serializer[T]]]

    Lookup a Collection Serializer

  22. def findCommonType[T](implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): Option[scala.reflect.macros.Universe.Expr[SimpleSerializer[T]]]

    Common types that I would like to define in CommonTypeImplicits but require the use of a macro to create and I don't want to create a separate project to avoid the separate compilation issue with macros.

  23. def findEnumSerializer[T](implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): Option[scala.reflect.macros.Universe.Expr[SimpleSerializer[T]]]

  24. def findOptionDeserializer[T](implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): Option[scala.reflect.macros.Universe.Expr[Deserializer[T]]]

  25. def findOptionSerializer[T](implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): Option[scala.reflect.macros.Universe.Expr[Serializer[T]]]

    Lookup an Option Serializer

  26. def getAccessorForMethod(tpe: scala.reflect.macros.Universe.Type, name: scala.reflect.macros.Universe.TermName): Option[Tree]

    Given a type and the name of a method return the tree that accesses that value

  27. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  28. def getConstructorWithSignature(tpe: scala.reflect.macros.Universe.Type, params: Seq[scala.reflect.macros.Universe.Type]): Option[scala.reflect.macros.Universe.MethodSymbol]

  29. def getFieldsForType(tpe: scala.reflect.macros.Universe.Type): Vector[scala.reflect.macros.Universe.TermSymbol]

    These come back "in the linearization order of their owners".

    These come back "in the linearization order of their owners". This means that if you have classes: class App extends AppBase { val foo: String = _ val bar: String = _ }

    class AppBase { val baz: String = _ val asd: String = _ }

    We end up with Vector(foo, bar, baz, asd)

  30. def getImplicit(implicitTpe: scala.reflect.macros.Universe.Type, withMacrosDisabled: Boolean = false): Option[Tree]

  31. def getJavaBeanFields(tpe: scala.reflect.macros.Universe.Type, strict: Boolean = true, allowMissingSetter: Boolean = false, sortBottomUp: Boolean = false): Vector[JavaBeanField]

    strict - Require all fields to have matching getters/setters allowMissingSetter - We allow the setter to be missing - this is for the case when we expect there to be no setter (but this isn't enforced, the caller must verify) sortBottomUp - See notes in sortFieldsBottomUp and getFieldsForType for info on the ordering

  32. def getMethodsForType(tpe: scala.reflect.macros.Universe.Type, name: scala.reflect.macros.Universe.TermName): Vector[scala.reflect.macros.Universe.MethodSymbol]

  33. def getMethodsForType(tpe: scala.reflect.macros.Universe.Type): Vector[scala.reflect.macros.Universe.MethodSymbol]

  34. def getNoArgsConstructor(tpe: scala.reflect.macros.Universe.Type): Option[scala.reflect.macros.Universe.MethodSymbol]

  35. def getNoArgsMethod(tpe: scala.reflect.macros.Universe.Type, name: scala.reflect.macros.Universe.TermName): Option[scala.reflect.macros.Universe.MethodSymbol]

  36. def getPublicMethodForType(tpe: scala.reflect.macros.Universe.Type): Vector[scala.reflect.macros.Universe.MethodSymbol]

  37. def getSingleArgMethod(tpe: scala.reflect.macros.Universe.Type, name: scala.reflect.macros.Universe.TermName): Option[scala.reflect.macros.Universe.MethodSymbol]

  38. def getSingleTypeParamAsSeenFrom(tpe: scala.reflect.macros.Universe.Type, baseType: scala.reflect.macros.Universe.Type): Option[scala.reflect.macros.Universe.Type]

    Same as extractSingleTypeParamAsSeenFrom except returns an Option

    Same as extractSingleTypeParamAsSeenFrom except returns an Option

    NOTE: This method returns None for 2 cases:

    1. - The type T isn't <:< the baseType 2. - There isn't exactly 1 type arg
  39. def hasConstructorWithSignature(tpe: scala.reflect.macros.Universe.Type, params: Seq[scala.reflect.macros.Universe.Type]): Boolean

  40. def hasImplicit(implicitTpe: scala.reflect.macros.Universe.Type, withMacrosDisabled: Boolean = false): Boolean

  41. def hasNoArgsConstructor(tpe: scala.reflect.macros.Universe.Type): Boolean

  42. def hasTransientAnnotation(sym: Symbol): Boolean

  43. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  44. object int

    For pattern matching an Int literal from a tree

  45. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  46. def isNoArgsMethod(method: scala.reflect.macros.Universe.MethodSymbol): Boolean

  47. def isSingleArgMethod(method: scala.reflect.macros.Universe.MethodSymbol): Boolean

  48. def javaBeanGetters(tpe: scala.reflect.macros.Universe.Type): Vector[scala.reflect.macros.Universe.MethodSymbol]

  49. def javaBeanSetters(tpe: scala.reflect.macros.Universe.Type): Vector[scala.reflect.macros.Universe.MethodSymbol]

  50. def makeFieldImpl(args: Seq[Tree], defaultName: String = null): FieldImpl

    Given the arguments for a Field (either from an expression creating a new instance of a Field or from an annotation) create a FieldImpl

  51. def makeFieldImpl(tree: Tree): FieldImpl

    Given a Tree for a Field, extract out the parameters and turn them into a FieldImpl

  52. def makeFieldImpl(expr: scala.reflect.macros.Context.Expr[Field]): FieldImpl

    Given an Expression for a Field, extract out the parameters and turn them into a FieldImpl

  53. def makeFieldImplsForCaseClass(tpe: scala.reflect.macros.Universe.Type): Seq[FieldImpl]

    Auto-Generate the FieldImpls for a Scala Case Class or Case Class Like

    Auto-Generate the FieldImpls for a Scala Case Class or Case Class Like

    The class is considered case class like if it has a primary constructor consisting of vals/vars with no other vars in the class.

  54. def makeFieldImplsForJavaBean(tpe: scala.reflect.macros.Universe.Type): Seq[FieldImpl]

    Auto-Generate the FieldImpls for a Java Bean class following the standard bean naming conventions.

    Auto-Generate the FieldImpls for a Java Bean class following the standard bean naming conventions.

    NOTE: The following restrictions are currently in place:

    • no-args constructor
    • Each field must have a corresponding getter and setter*
    • There must be no extra getters or setters

    * - The setter can be missing if the field is of type java.util.List to support the case where use the getter to get an instance of java.util.List and then call addAll the populate it. (This pattern is used by some JAXB generated code that we have)

  55. def makeFieldImplsForJavaBeanImmutable(tpe: scala.reflect.macros.Universe.Type): Seq[FieldImpl]

    Auto-Generate the FieldImpls for an IMMUTABLE Java Bean class following the standard bean naming conventions.

    Auto-Generate the FieldImpls for an IMMUTABLE Java Bean class following the standard bean naming conventions.

    NOTE: The following restrictions are currently in place:

    • Must have a "Value Constructor"
    • Each field must have a corresponding getter
    • There must be no extra getters

    * - This is targeted at the JAXB Value Constructor Plugin and Immutable Plugin:

    https://java.net/projects/jaxb2-commons/pages/Value-constructor https://github.com/mklemm/jaxb2-rich-contract-plugin

  56. def makeNormalCollectionDeserializer(tpe: scala.reflect.macros.Universe.Type, elemTpe: scala.reflect.macros.Universe.Type): Tree

  57. def makeObjectDeserializer[T](fields: Seq[FieldImpl])(implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): scala.reflect.macros.Universe.Expr[ObjectDeserializer[T]]

  58. def makeObjectSerializer[T](fields: Seq[FieldImpl])(implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): scala.reflect.macros.Universe.Expr[ObjectSerializer[T]]

    Attempt to create a SimpleSerializer for the type

  59. def makeSimpleObjectSerializer[T](fields: Seq[FieldImpl])(implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): scala.reflect.macros.Universe.Expr[SimpleObjectSerializer[T]]

  60. def makeStringMapCollectionDeserializer(tpe: scala.reflect.macros.Universe.Type, elemTpe: scala.reflect.macros.Universe.Type): Tree

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

    Definition Classes
    AnyRef
  62. def noArgsConstructor(tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.MethodSymbol

  63. def noArgsMethod(tpe: scala.reflect.macros.Universe.Type, name: scala.reflect.macros.Universe.TermName): scala.reflect.macros.Universe.MethodSymbol

  64. final def notify(): Unit

    Definition Classes
    AnyRef
  65. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  66. def resolveType(objTpe: scala.reflect.macros.Universe.Type, tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Type

    Determine the return type of a method substituting generic parameters with real types if applicable.

  67. def sortFieldsBottomUp(fields: Vector[scala.reflect.macros.Universe.TermSymbol]): Vector[scala.reflect.macros.Universe.TermSymbol]

    See the notes below for getFieldsForType().

    See the notes below for getFieldsForType(). For that example this gives you: Vector(baz, asd, foo, bar)

    The XJC Value Constructor plugin generates constructor arguments in this order.

  68. object string

    For pattern matching a String literal from a tree

  69. def substituteGenericTypes(tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Type

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

    Definition Classes
    AnyRef
  71. def toString(): String

    Definition Classes
    AnyRef → Any
  72. def tryMakeObjectDeserializer[T]()(implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): Option[scala.reflect.macros.Universe.Expr[ObjectDeserializer[T]]]

  73. def tryMakeObjectSerializer[T]()(implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): Option[scala.reflect.macros.Universe.Expr[ObjectSerializer[T]]]

  74. def tryMakeObjectSerializerForInterface[IFACE, CONCRETE]()(implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[IFACE], arg1: scala.reflect.macros.Universe.WeakTypeTag[CONCRETE]): Option[scala.reflect.macros.Universe.Expr[ObjectSerializer[IFACE]]]

    This creates an ObjectSerializer for an interface/trait based on the field information of a concrete type.

    This creates an ObjectSerializer for an interface/trait based on the field information of a concrete type.

    e.g. You can have a "trait Foo { def name: String }" and a "case class FooImpl(name: String)". The fields will be read from FooImpl but the serializer will be for Foo. This means the Foo must have the same methods as FooImpl for it to work.

  75. def typeArgsFor(tpe: scala.reflect.macros.Universe.Type): List[scala.reflect.macros.Universe.Type]

    Determine the type arguments for a type.

    Determine the type arguments for a type. e.g.: List[Int] => Int Map[String,Int] => String,Int

  76. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped