org.specs2.form

Prop

case class Prop[T, S](label: String, actual: Property[T], expected: Property[S], constraint: (T, S) ⇒ Result, decorator: Decorator) extends Executable with DecoratedProperty[Prop[T, S]] with Product with Serializable

The Prop class is a named property which holds:

This property can be executed and can be inserted in a Form.

A Prop is meant to be declared as "bound" to an actual value:

val customerName = Prop("Customer name", person.name)

[the actual value is not evaluated until the Prop is executed]

Then it can be associated an expected value with the apply method (usually in a Form declaration):

customerName("Bill")

The actual and the expected values can have different types and the constraint which is applied to them can be anything returning a result.

However the Prop companion object provides a method to create a Property with a constraint using a beEqualTo matcher:

Prop("Name", "Eric")("Eric") must_== Success("'Eric' is equal to 'Eric'")

Linear Supertypes
Serializable, Serializable, Product, Equals, DecoratedProperty[Prop[T, S]], DecoratedLabel[Prop[T, S]], Executable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Prop
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. DecoratedProperty
  7. DecoratedLabel
  8. Executable
  9. AnyRef
  10. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Prop(label: String = "", actual: Property[T] = control.Property.apply[T](), expected: Property[S] = control.Property.apply[S](), constraint: (T, S) ⇒ Result = Prop.checkProp[Any, Nothing], decorator: Decorator = ...)

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. val actual: Property[T]

  7. lazy val actualValue: Product with Serializable with Either[Result, T]

    returns

    the actual value as either Right(value) or Left(result)

  8. def apply(e: ⇒ S): Prop[T, S]

    The apply method sets the expected value and returns the Prop

  9. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  10. def canEqual(arg0: Any): Boolean

    Definition Classes
    Prop → Equals
  11. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  12. val constraint: (T, S) ⇒ Result

  13. def decorateLabel(ns: Any): Any

    do the decoration

    do the decoration

    Definition Classes
    DecoratedLabel
  14. def decorateLabelWith(f: (Any) ⇒ Any): Prop[T, S]

    set a new Decorator for the label

    set a new Decorator for the label

    Definition Classes
    DecoratedLabel
  15. def decorateValue(ns: Any): Any

    do the decoration

    do the decoration

    Definition Classes
    DecoratedProperty
  16. def decorateValueWith(f: (Any) ⇒ Any): Prop[T, S]

    set a new Decorator for the value

    set a new Decorator for the value

    Definition Classes
    DecoratedProperty
  17. def decorateWith(f: (Any) ⇒ Any): Prop[T, S]

    set a new Decorator

    set a new Decorator

    Definition Classes
    DecoratedProperty
  18. val decorator: Decorator

    Definition Classes
    PropDecoratedLabel
  19. def decoratorIs(d: Decorator): Prop[T, S]

    set a new Decorator

    set a new Decorator

    Definition Classes
    PropDecoratedLabel
  20. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  21. def equals(a: Any): Boolean

    Definition Classes
    Prop → Equals → AnyRef → Any
  22. def execute: Result

    execute the constraint set on this property, with the expected value

    execute the constraint set on this property, with the expected value

    returns

    a Result

    Definition Classes
    PropExecutable
  23. val expected: Property[S]

  24. lazy val expectedValue: Product with Serializable with Either[Result, S]

    returns

    the expected value as an option

  25. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  26. def get: S

    shortcut method for this().

    shortcut method for this().get returning the contained expected value.

    returns

    the expected value if set and throws an exception otherwise

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

    Definition Classes
    AnyRef → Any
  28. def hashCode(): Int

    Definition Classes
    Prop → AnyRef → Any
  29. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  30. val label: String

  31. def labelStyles: String

    return the label styles

    return the label styles

    Definition Classes
    DecoratedLabel
  32. def map(f: (Result) ⇒ Result): Executable

    modify the result to return

    modify the result to return

    Definition Classes
    Executable
  33. def matchWith(c: (T, S) ⇒ Result): Prop[T, S]

    set a specific constraint on the property

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

    Definition Classes
    AnyRef
  35. final def notify(): Unit

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

    Definition Classes
    AnyRef
  37. def productArity: Int

    Definition Classes
    Prop → Product
  38. def productElement(arg0: Int): Any

    Definition Classes
    Prop → Product
  39. def productIterator: Iterator[Any]

    Definition Classes
    Product
  40. def productPrefix: String

    Definition Classes
    Prop → Product
  41. def resultIs(r: ⇒ Result): Prop[T, S]

    set a specific result on the property

  42. def styleLabelWith(s: (String, String)): Prop[T, S]

    set a new style for the label

    set a new style for the label

    Definition Classes
    DecoratedLabel
  43. def styleValueWith(s: (String, String)): Prop[T, S]

    set a new style for the value

    set a new style for the value

    Definition Classes
    DecoratedProperty
  44. def styleWith(s: (String, String)): Prop[T, S]

    set a new style

    set a new style

    Definition Classes
    DecoratedProperty
  45. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  46. def toString(): String

    Display the property:

    Display the property:

    label: "this" (actual: "that")

    Definition Classes
    Prop → AnyRef → Any
  47. def valueStyles: String

    Definition Classes
    DecoratedProperty
  48. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()

Deprecated Value Members

  1. def productElements: Iterator[Any]

    Definition Classes
    Product
    Annotations
    @deprecated
    Deprecated

    (Since version 2.8.0) use productIterator instead

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from DecoratedProperty[Prop[T, S]]

Inherited from DecoratedLabel[Prop[T, S]]

Inherited from Executable

Inherited from AnyRef

Inherited from Any