SchemaCriterion

final case class SchemaCriterion(vendor: String, name: String, format: String, model: Option[Int], revision: Option[Int], addition: Option[Int])

Filter self-describing schemas by SchemaKey.

Companion:
object
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Value members

Concrete methods

def asString: String

Format this SchemaCriterion as an Iglu schema URI, whereby the REVISION and ADDITION may be replaced with "*" wildcards.

Format this SchemaCriterion as an Iglu schema URI, whereby the REVISION and ADDITION may be replaced with "*" wildcards.

Returns:

The string representation of this criterion.

def matches(key: SchemaKey): Boolean

Check if a SchemaKey is valid.

Check if a SchemaKey is valid.

It's valid if the vendor, name, format, and model all match and the supplied key's REVISION and ADDITION do not exceed the criterion's REVISION and ADDITION.

Value parameters:
key

The SchemaKey to validate.

Returns:

true if the SchemaKey is valid.

def pickFrom[E : ExtractSchemaKey](entities: Seq[E]): Seq[E]

Filter a sequence of entities by this SchemaCriterion.

Filter a sequence of entities by this SchemaCriterion.

Can be used for getting only the Right JSON instances out of an array of custom contexts.

Usage:

 // This will get the best match for an entity
 criterion.takeFrom(_.schema)(entities).sort.getOption
Type parameters:
E

The base type of the self-describing data, having an ExtractSchemaKey instance in scope.

Value parameters:
entities

A list of self-describing data blobs.

Returns:

A list of matching entities.

def versionString: String

Stringify the version of this SchemaCriterion.

Stringify the version of this SchemaCriterion.

Inherited methods

def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product