package auto_require
- Alphabetic
- By Inheritance
- auto_require
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
sealed
trait
DisplayConfig extends AnyRef
Sub-types of this trait change the error message generation of auto_require functions.
-
final
case class
InfixOnlyOperators(value: Boolean) extends DisplayConfig with Product with Serializable
Whether to infix single arg methods beside the standard operators such as '>', '==', ...
Whether to infix single arg methods beside the standard operators such as '>', '==', ...
Example:
Instant.now.compareTo(otherInstant) // false (Instant.now compareTo otherInstant) // true
Default: false
-
final
case class
SimpleNameSegments(value: Int) extends DisplayConfig with Product with Serializable
How many segments to use of a full name as simple name (mostly useful for nested types).
Requesting more segment than available will result in a compile error.How many segments to use of a full name as simple name (mostly useful for nested types).
Requesting more segment than available will result in a compile error.Example:
val fullName = com.example.Object.NestedType val simpleName_1 = NestedType // 1 val simpleName_2 = Object.NestedType // 2
Default: 1
-
final
case class
StripTypeNameSuffix(value: Boolean) extends DisplayConfig with Product with Serializable
Whether to strip the suffix '.Type' from a full name before taking segments as simple name.
This is mostly relevant for tagged value class implementations such as scala-newtypeWhether to strip the suffix '.Type' from a full name before taking segments as simple name.
This is mostly relevant for tagged value class implementations such as scala-newtypeExample:
package object types { @newtype final case class WidgetId(toInt: Int) val fullNameFalse = package.WidgetId.Type // false val fullNameTrue = package.WidgetId // true }
Default: true
Value Members
-
macro
def
autoRequire[A](expression: Boolean, overrides: DisplayConfig*): Unit
Tests the given
expression
, throwing anIllegalArgumentException
if false.
In contrast to Scala's standardrequire
, error messages are generated automatically.Tests the given
expression
, throwing anIllegalArgumentException
if false.
In contrast to Scala's standardrequire
, error messages are generated automatically.- A
Used to generate a context name as part of the error message. Must not be
Nothing
.- expression
The expression to test.
- overrides
Allows for customizing the auto-generated error message. Check
DisplayConfig
and its sub-types for more info.- returns
Unit
if and only if the givenexpression
is true. Throws anIllegalArgumentException
otherwise.
- Annotations
- @throws( ... )
-
macro
def
autoRequireEither[A](expression: Boolean, overrides: DisplayConfig*): Either[String, Unit]
Tests the given
expression
, returning aLeft
containing an error message if false.
In contrast to Scala's standardrequire
, error messages are generated automatically.Tests the given
expression
, returning aLeft
containing an error message if false.
In contrast to Scala's standardrequire
, error messages are generated automatically.- A
Used to generate a context name as part of the error message. Must not be
Nothing
.- expression
The expression to test.
- overrides
Allows for customizing the auto-generated error message. Check
DisplayConfig
and its sub-types for more info.- returns
Left
if and only if the givenexpression
is true.Right