The companion class to Field
Note: The setter is optional if the type is a java.
Given a class find the companion object
Given a type a a method of that type return the default values for the parameters of the method
Extract Field annotations for a type and convert them into FieldImpls
e.
e.g. extractSingleTypeParamAsSeenFrom[Map[String,Int]](typeOf[TraversableOnce[_]]) => (String,Int)
Lookup a Collection Serializer
Lookup a Collection Serializer
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.
Lookup an Option Serializer
Given a type and the name of a method return the tree that accesses that value
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)
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
Same as extractSingleTypeParamAsSeenFrom except returns an Option
Same as extractSingleTypeParamAsSeenFrom except returns an Option
NOTE: This method returns None for 2 cases:
For pattern matching an Int literal from a tree
Given the arguments for a Field (either from an expression creating a new instance of a Field or from an annotation) create a FieldImpl
Given a Tree for a Field, extract out the parameters and turn them into a FieldImpl
Given an Expression for a Field, extract out the parameters and turn them into a 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.
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:
* - 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)
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:
* - 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
Attempt to create a SimpleSerializer for the type
Determine the return type of a method substituting generic parameters with real types if applicable.
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.
For pattern matching a String literal from a tree
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.
Determine the type arguments for a type.
Determine the type arguments for a type. e.g.: List[Int] => Int Map[String,Int] => String,Int