
com.nthportal.versions.extensions.RichExtensionParser.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of versions_2.11 Show documentation
Show all versions of versions_2.11 Show documentation
A Scala library for representing versions as objects.
The newest version!
package com.nthportal.versions
package extensions
/**
* An [[ExtensionParser]] with extra utility methods.
*
* @tparam E the type of the version extension
* @define ext E
*/
private[extensions] trait RichExtensionParser[E] extends ExtensionParser[E] {
/**
* Returns a parser for $ext extensions.
*
* @return a parser for $ext extensions
*/
implicit def extensionParser: ExtensionParser[E] = this
/**
* Throws an [[IllegalArgumentException]] for an invalid extension.
*
* @param extension the invalid extension string
* @param cause the exception making the extension invalid (`null` if none)
* @throws IllegalArgumentException always
* @return Nothing
*/
@throws[IllegalArgumentException]
protected def invalidExtension(extension: String, cause: Throwable = null): Nothing = {
throw new IllegalArgumentException(s"Invalid extension: $extension", cause)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy