![JAR search and dependency download from the Maven repository](/logo.png)
org.scalatra.util.NotEmpty.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalatra_2.10 Show documentation
Show all versions of scalatra_2.10 Show documentation
The core Scalatra framework
The newest version!
package org.scalatra.util
/**
* Extractor object, useful for handling empty form parameter submissions:
*
* params.get("foo") match {
* case NotEmpty(value) => processValue(value)
* case _ => message("foo is required")
* }
*/
object NotEmpty {
def unapply(s: String): Option[String] = {
if (s != null && !s.isEmpty) Some(s)
else None
}
def unapply(o: Option[String]): Option[String] = {
o flatMap { s => unapply(s) }
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy