main.kotlin.ch.tutteli.atrium.logic.creating.feature.MetaFeature.kt Maven / Gradle / Ivy
package ch.tutteli.atrium.logic.creating.feature
import ch.tutteli.atrium.core.None
import ch.tutteli.atrium.core.Option
import ch.tutteli.atrium.core.Some
import ch.tutteli.atrium.reporting.translating.Translatable
import ch.tutteli.atrium.reporting.translating.Untranslatable
/**
* Represents an extracted feature of type [T] defined by the given [maybeSubject] including a [description]
* and a [representation]
*
* @property description Will be used in reporting to describe the feature extraction - e.g. the name of a property,
* a method call etc.
* @property representation The representation of the feature, in most cases the value behind the feature.
* @property maybeSubject The feature as such where it is [Some] in case the extraction was successful or [None] if it
* was not.
*/
data class MetaFeature(val description: Translatable, val representation: Any?, val maybeSubject: Option) {
constructor(description: String, representation: Any?, maybeSubject: Option) :
this(Untranslatable(description), representation, maybeSubject)
constructor(description: String, subject: T) : this(description, subject, Some(subject))
}