package syntax
Contains implicit classes used to add extension methods.
The implicit classes are used to add the following extension methods:
showLocal
displays a language dependent version of an objectjsonLocal
generates a JSON string with language dependent stringsmasonLocal
generates a Mason Draft 2 compliant JSON string for Errorfold
functionality for Boolean type
All traits found in the package are for the implementation of extension methods. The traits are mixed into the Implicits object so they can be easily imported into clients when required.
- Source
- package.scala
Type Members
- trait BooleanSyntax extends AnyRef
Adds extension methods to scala.Boolean
Adds extension methods to scala.Boolean
The implicit class used to contain the extension methods is wrapped in this trait so they can be mixed in with the Implicits object.
The
Syntax
naming convention implies the trait adjusts the syntax of Boolean. In this case it adds extension methods. - trait ErrorSyntax extends AnyRef
Adds extension methods to Error
- trait JsonLocalSyntax extends AnyRef
Contains implicit class to add
jsonLocal
extension methodContains implicit class to add
jsonLocal
extension methodA trait is used to contain the
jsonLocal
extension method so it can be mixed into the Implicits object allowing the implicit class to be in scope when using the following import statement:import com.axiell.util.Implicits._
- trait MasonLocalSyntax extends AnyRef
Adds extension methods to Error
Adds extension methods to Error
The implicit class used to contain the extension methods is wrapped in this trait so they can be mixed in with the Implicits object.
The
Syntax
naming convention implies the trait adjusts the syntax of Error. In this case it adds extension methods.The extension methods provided allow error context information to be added to an Error that allows a Mason Draft 2 JSON error object to be generated. The following methods, along with their context label, are supported:
withId
(@id)withMessages
(@messages)withDetails
(@details)withHttpStatusCode
(@httpStatusCode)withControls
(@controls)withTime
(@time)
The
mason
extension method is also added to generate the Mason Draft 2 compliant JSON error object as a string. - trait ShowLocalSyntax extends AnyRef
Contains implicit class to add
showLocal
extension methodContains implicit class to add
showLocal
extension methodA trait is used to contain the
showLocal
extension method so it can be mixed into the Implicits object allowing the implicit class to be in scope when using the following import statement:import com.axiell.util.Implicits._
Documentation for the Axiell Utilities Project
Overview
The Axiell Utilities Project attempts to provide a small library of classes and object applicable to most Axiell developments. The library is not geared towards any one project and so should be useful for new projects as well as existing ones.
The library is based on a few simple principles, namely:
Package structure
The
package consists of a number of utilities, where each utility provides a single piece of functionality.com.axiell.util
Notable utilities are:
Configure
generic configuration reader allowing application settings defined as resources to be interrogated.Error
generic error handling class defining a locale independent error message along with details relating to the context of the error. The context may include an exception and other relevant values.Formatter
retrieves and formats a locale specific string from a specified resource bundle. The formatting is specified in aC
printf style.Implicits
implements implicit methods and classes used to pimp methods onto existing classes (e.g.fold()
method toBoolean
class) and to provide implicit implementations for the JsonLocal and ShowLocal type classes.JsonLocal
type class used to output locale specific JSON structures. Implementations exist for Message and Error.Message
provides a locale independent mechanism for handling strings. The strings for a given locale are stored in resource bundles that are accessed when the message is to be displayed.ShowLocal
type class used to show locale specific strings. Allows Message and Error to be converted to a given language string.Dependencies
The list of dependencies are:
Typesafe Config
a generic configuration file reader. The library is used by theConfigure
class to access settings stored as resources within an application.