Class

fm.serializer

MacroHelpers

Related Doc: package serializer

Permalink

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
Visibility
  1. Public
  2. All

Instance Constructors

  1. new MacroHelpers(isDebug: Boolean)

    Permalink

Type Members

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

    Permalink

    The companion class to Field

    The companion class to Field

    We take the arguments to the Field class (either as an Annotation or as "new Field(...)" expressions) and generate a FieldImpl from them. This means that for the Int and String fields you can only use literals that can be used a compile time. The serializer/deserialize can be arbitrary trees.

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

    Permalink

    Note: The setter is optional if the type is a java.util.List in which case the getter is expected to initialize the list.

Abstract Value Members

  1. abstract val ctx: Context

    Permalink

Concrete 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 cleanFieldImpls(fields: Seq[FieldImpl]): Vector[FieldImpl]

    Permalink
  6. def clone(): AnyRef

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

    Permalink

    Given a class find the companion object

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

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

    Permalink

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

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

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

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

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

    Permalink

    Extract Field annotations for a type and convert them into FieldImpls

  14. def extractRenameFieldAnnotations(tpe: scala.reflect.macros.Universe.Type): Map[String, String]

    Permalink

    Extract RenameField annotations and return a Map of the Old Name => New Name

  15. def extractRenameFieldAnnotations[T](implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): Map[String, String]

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

    Permalink

    e.g.

    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]

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

    Permalink
  19. def findAnyValDeserializer[T](implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): Option[scala.reflect.macros.Universe.Expr[Deserializer[T]]]

    Permalink
  20. def findAnyValSerializer[T](implicit arg0: scala.reflect.macros.Universe.WeakTypeTag[T]): Option[scala.reflect.macros.Universe.Expr[Serializer[T]]]

    Permalink

    Lookup an AnyVal Serializer

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

    Permalink

    Lookup a Collection Serializer

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

    Permalink

    Lookup a Collection Serializer

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

    Permalink

    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.

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

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

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

    Permalink

    Lookup an Option Serializer

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

    Permalink

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

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

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

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

    Permalink

    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)

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

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

    Permalink

    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

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

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

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

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

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

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

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

    Permalink

    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
  40. def hasConstructorWithSignature(tpe: scala.reflect.macros.Universe.Type, params: Seq[scala.reflect.macros.Universe.Type]): Boolean

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

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

    Permalink
  43. def hasTransientAnnotation(sym: scala.reflect.macros.Universe.Symbol): Boolean

    Permalink
  44. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  45. object int

    Permalink

    For pattern matching an Int literal from a tree

  46. final def isInstanceOf[T0]: Boolean

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

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

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

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

    Permalink
  51. def makeFieldImpl(args: Seq[scala.reflect.macros.Universe.Tree], defaultName: String = null, defaultNumber: Int = 1): FieldImpl

    Permalink

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

  52. def makeFieldImpl(tree: scala.reflect.macros.Universe.Tree): FieldImpl

    Permalink

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

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

    Permalink

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

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

    Permalink

    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.

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

    Permalink

    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)

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

    Permalink

    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

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

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

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

    Permalink

    Attempt to create a SimpleSerializer for the type

  60. def makeRenameFieldImpl(args: Seq[scala.reflect.macros.Universe.Tree]): String

    Permalink

    Given the arguments for a RenameField (either from an expression creating a new instance of a Field or from an annotation) return the name field

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

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

    Permalink
  63. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
  66. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  67. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  68. def resolveType(objTpe: scala.reflect.macros.Universe.Type, tpe: scala.reflect.macros.Universe.Type): scala.reflect.macros.Universe.Type

    Permalink

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

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

    Permalink

    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.

  70. object string

    Permalink

    For pattern matching a String literal from a tree

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

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

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

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

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

    Permalink
  76. 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]]]

    Permalink

    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.

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

    Permalink

    Determine the type arguments for a type.

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

  78. final def wait(arg0: Long, arg1: Int): Unit

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  80. final def wait(): Unit

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

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped