object-builder

Object Builder

License

License

GroupId

GroupId

com.jparams
ArtifactId

ArtifactId

object-builder
Last Version

Last Version

2.3.1
Release Date

Release Date

Type

Type

jar
Description

Description

object-builder
Object Builder
Project URL

Project URL

https://github.com/jparams/object-builder
Project Organization

Project Organization

JParams
Source Code Management

Source Code Management

https://github.com/jparams/object-builder

Download object-builder

How to add to project

<!-- https://jarcasting.com/artifacts/com.jparams/object-builder/ -->
<dependency>
    <groupId>com.jparams</groupId>
    <artifactId>object-builder</artifactId>
    <version>2.3.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.jparams/object-builder/
implementation 'com.jparams:object-builder:2.3.1'
// https://jarcasting.com/artifacts/com.jparams/object-builder/
implementation ("com.jparams:object-builder:2.3.1")
'com.jparams:object-builder:jar:2.3.1'
<dependency org="com.jparams" name="object-builder" rev="2.3.1">
  <artifact name="object-builder" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.jparams', module='object-builder', version='2.3.1')
)
libraryDependencies += "com.jparams" % "object-builder" % "2.3.1"
[com.jparams/object-builder "2.3.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Object Builder

Maven Central Build Status Javadocs

Getting Started

Get Object Builder

Maven:

<dependency>
    <groupId>com.jparams</groupId>
    <artifactId>object-builder</artifactId>
    <version>2.x.x</version>
</dependency>

Gradle:

compile 'com.jparams:object-builder:2.x.x'

What is Object Builder?

Object Builder is a highly configurable and robust library for building instances of objects. Just supply a class and Object Builder will supply an instance.

Object Builder works using a combination of constructor and field injection.

Build an Object

Building an object is easy, just configure the builder and let it do the job! Here is very simple example:

public class Application {
    public static void main(String[] args) {
        final ObjectBuilder objectBuilder = ObjectBuilder.withDefaultConfiguration();
        final Person person = objectBuilder.buildInstanceOf(Person.class).get();
    }
    
    public static class Person {
        private String name;
        private LocalDate dob;
        private List<Address> addresses;
    }
    
    public static class Address {
        private String line1;
        private String line2;
        private String city;
    }
}

Compatibility

This library is compatible with Java 8 and above.

License

MIT License

Copyright 2018 JParams

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Versions

Version
2.3.1
2.2.1
2.1.1
2.0.2
2.0.1
1.0.10
1.0.9
1.0.7
1.0.6
1.0.5
1.0.3
1.0.2
1.0.1