<img src="https://img.shields.io/hexpm/l/plug.svg" alt="License: Apache 2"> <img src="https://travis-ci.com/ArpNetworking/commons.svg?branch=master" alt="Travis Build"> <img src="https://img.shields.io/maven-central/v/com.arpnetworking.commons/commons.svg" alt="Maven Artifact"> <img src="http://www.javadoc.io/badge/com.arpnetworking.commons/commons.svg" alt="Javadocs">
Common utility methods and classes.
Determine the latest version of the commons in Maven Central.
Add a dependency to your pom:
<dependency>
<groupId>com.arpnetworking.commons</groupId>
<artifactId>commons</artifactId>
<version>VERSION</version>
</dependency>
The Maven Central repository is included by default.
Add a dependency to your build.gradle:
compile group: 'com.arpnetworking.commons', name: 'commons', version: 'VERSION'
Add the Maven Central Repository into your build.gradle:
repositories {
mavenCentral()
}
Add a dependency to your project/Build.scala:
val appDependencies = Seq(
"com.arpnetworking.commons" % "commons" % "VERSION"
)
The Maven Central repository is included by default.
The project does not declare any non-essential transitive dependencies. For example, it does declare a dependency on SLF4J; however, most other dependencies are marked as provided and should be declared by users of the library. This allows clients to declare only the dependencies of the features that they use, instead of automatically inheriting all dependencies of commons. Each component documents its dependencies and the version defined in the pom for testing should be considered the minimum version of each dependency. As the library grows we may consider splitting it into a multi-module project with each submodule explicitly declaring its dependencies.
The factory exposes a global singleton Jackson's ObjectMapper
via the getInstance
method to reduce memory
footprint and to ensure a consistent global configuration for ObjectMapper
. The global instance is read-only and
is protected by a dynamic proxy which prevents modification. The factory can also create new modifiable instances with
the same base configuration via the createInstance
method.
If these modules are available they are registered with ObjectMapper
:
Additionally, you may specify a comma separated list of additional module class names to register using the system property commons.object-mapper-additional-module-class-names. For example:
-Dcommons.object-mapper-additional-module-class-names=com.example.MyModule,com.fasterxml.jackson.module.afterburner.AfterburnerModule
Add the Maven Javassist Plugin to your project and configure it to execute the ValidationProcessor. Optionally, enable processing of test classes with the test-process goal.
<plugin>
<groupId>com.arpnetworking.commons</groupId>
<artifactId>javassist-maven-plugin</artifactId>
<version>0.1.0</version>
<executions>
<execution>
<id>javassist-process</id>
<goals>
<goal>process</goal>
</goals>
<configuration>
<processor>com.arpnetworking.commons.builder.ValidationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
Next, add a dependency on maven-javassist-core:
<dependency>
<groupId>com.arpnetworking.commons</groupId>
<artifactId>javassist-maven-core</artifactId>
<version>0.1.0</version>
</dependency>
Processing the validation rules into your classes instead of using OVal's built-in reflective processing can greatly improve the performance of your application.
Prerequisites:
Building:
commons> ./jdk-wrapper.sh ./mvnw verify
To use the local version you must first install it locally:
commons> ./jdk-wrapper.sh ./mvnw install
You can determine the version of the local build from the pom file. Using the local version is intended only for testing or development.
You may also need to add the local repository to your build in order to pick-up the local version:
Running:
commons> ./jdk-wrapper.sh ./mvnw test -PunitPerformanceTest
Results:
target/perf
as specified in each test's JsonBenchmarkConsumer
.profileFile
field.Published under Apache Software License 2.0, see LICENSE
© Groupon Inc., 2015