score:1
Accepted answer
the simplest way is probably to use a self type annotation:
trait privatefield[fieldtype <: any, ownertype <: mapper[ownertype]] {
self: mappedfield[fieldtype, ownertype] =>
override def writepermission_? = false
override def readpermission_? = false
override def shoulddisplay_? = false
override def show_? = false
}
then you can use it in this manner:
mappedint(this) with privatefield[int, mytable]
Source: stackoverflow.com
Related Query
- How do I make a trait that I can mix into mapped fields to that I don not have to override the same properties for many fields in a database?
- If I have an SBT multi-project build, how can I make A's test dependencies not leak in to B's tests
- How to make sure classes that use trait have certain classes in them?
- How do I write a trait that can mix in overrides of CRUDify members (that need to access the User model) in Mapper models?
- How do I make a trait to mix in with an object that extends MappedLongForeignKey, that will override def asHtml and def validSelectValues?
- How to make sure that worker node can not change the broadcast variable in spark?
- how to make saveAsTextFile NOT split output into multiple file?
- How can I make A future of future into one future object?
- Is it possible and how to have var that can only be set once?
- How can I prove that two types have no subtyping relation in Scala?
- How to require at compile time that a type parameter be a trait (and not a class or other type value)?
- Gentle Intro to Haskell: " .... there is no single type that contains both 2 and 'b'." Can I not make such a type ?
- How to implicitly wrap a value that can be null or an array into an Scala Option
- How to make compiler check that 2 method arguments have the same type?
- In sbt, how can I cross-build with dependencies that are not required in one version?
- In the scala spray framework, how can I create multiple http clients that have different configurations (e.g., timeouts, retries)
- How do I parse a deeply nested JSON document that may have some missing or extra fields using Scala?
- How to make a tail-recursive method that can also refer to itself in a non-tail-recursive way
- I have a Expr value that have two child Expr in Scala, how can I execute this in tail position?
- Scala How can Trait override toString Case Class that is Derived Off
- How can I create a pair of immutable Scala instances that have references to each other?
- How to tell to the compiler a function can only return subtype of a trait and not the trait itself?
- How to stream a `Seq[Future[_]]` into either a `Future[Stream[_]]` or a `Stream[_]` such that it can consumed as it becomes available in order?
- If I have RDD[(String, String)], how can I save first element of tuple into one file and store second elements into another file?
- How can I make a Map[ (Int,Int) , List[Int] ] that spans from (0,0) to (8,8)?
- How can I check that method parameters have the same type as the methods this?
- Scala - how to make the SortedSet with custom ordering hold multiple different objects that have the same value by which we sort?
- How can I have a typed (specific) factory in a base trait in Scala?
- How can I extract shared Scala enum logic into a trait or superclass?
- How can I make a scala method parameter type that is a collection of multiple types that can be converted to a given type?
More Query from same tag
- Mockito verify fails with "TooManyActualInvocations" for method with a default parameter in Scala
- How to convert csv file to Seq[String]?
- MergeSort in scala
- How to apply an action refiner to all requests sent to a SIRD Router?
- Create collection of cartesian product of two (and more) lists with Java Lambda
- Weird scala tuple behavior
- Scala cast to generic type (for generic numerical function)
- Scala shapeless function corresponding to the vanilla "zipped" on regular lists?
- Scala - Pattern matching on arrays doesn't warn for missing cases
- Scala Specs2 Matchers with "aka" doesn't work
- Testing scala Play (2.2.1) controllers with CSRF protection
- Scala Play 2.5.0 2.5.1 Filtering with access to result body
- Regex Extraction in Scala
- Constructor parameters with same name as atributes
- Spark: Convert RDD[String] to DataFrame
- Scala how to match two dfs if mathes then update the key in first df and select all columns from required df
- flatten nested data structure in Spark
- Adding new Columns based on aggregation on existing column in Spark DataFrame using scala
- How to create an infinite collection from a Scala Set
- Scala JPA in netbeans
- What's the syntax for multiple dependency injection using Spring and Scala?
- Is this definition of a tail recursive fibonacci function tail-recursive?
- How to get ROUTE_PATTERN from request in play 2.6 scala
- When the data inside RequestVar will be cleared?
- How to filter the same elements from two sources
- Boolean logic in lambda calculus in Scala
- Changing version for a transitive dependency in gradle
- Spark need an RDD.take with a big argument. Result should be an RDD
- Akka Actors: Handling DB Failures Without Losing Data
- What is the Java equivalent of this Scala code?