SkillAgentSearch skills...

Bull

BULL - Bean Utils Light Library

Install / Use

/learn @ExpediaGroup/Bull

README

<h1> <img width="420" alt="BULL" src="./docs/site/resources/images/BullBranding_04.png"> </h1>

Bean Utils Light Library

BULL is a Java Bean to Java Bean transformer that recursively copies data from one object to another, it is generic, flexible, reusable, configurable, and incredibly fast. It's the only library able to transform Mutable, Immutable, and Mixed bean without any custom configuration.

Start using

Maven Central Javadocs Build Status Join the chat at https://join.slack.com/t/bull-crew/shared_invite/enQtNjM1MTE5ODg1MTQzLWI5ODhhYTQ2OWQxODgwYzU1ODMxMWJiZDkzODM3OTJkZjBlM2MwMTI3ZWZjMmU0OGZmN2RmNjg4NWI2NTMzOTk

GitHub site Coverage Status License Dependabot

A tutorial that integrates the library can be found here.

All BULL modules are available on Maven Central:

  • Bean BOM

It contains all the modules available in the project


<dependency>
    <groupId>com.expediagroup.beans</groupId>
    <artifactId>bull-bom</artifactId>
    <version>x.y.z</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>
  • Bean Transformer


<dependency>
    <groupId>com.expediagroup.beans</groupId>
    <artifactId>bull-bean-transformer</artifactId>
    <version>x.y.z</version>
</dependency>
  • Map Transformer


<dependency>
    <groupId>com.expediagroup.beans</groupId>
    <artifactId>bull-map-transformer</artifactId>
    <version>x.y.z</version>
</dependency>

The project provides two different builds, one compatible with jdk 8 (or above), one with jdk 11 and on with jdk 17 or above.

In case you need to integrate it in a:

Some jdk versions remove the Java Bean constructor's argument names from the compiled code and this may cause problems to the library. On top of that, it's suggested to configure the maven-compiler-plugin, inside your project, as follow:

<build>
    ...
    <pluginManagement>
        <plugins>
            ...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                    <parameters>true</parameters>
                    <forceJavacCompilerUse>true</forceJavacCompilerUse>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    ...
</build>

Maven build

Full build

./mvnw clean install

or on Windows

mvnw.cmd clean install

Skip test coverage and checkstyle check

./mvnw clean install -P relaxed

or on Windows

mvnw.cmd clean install -P relaxed

Check for dependencies update

mvn versions:display-dependency-updates -P check-for-updates

or on Windows

mvnw.cmd versions:display-dependency-updates -P check-for-updates

Features:

  • support copy of immutable beans.
  • support copy of mutable beans.
  • support copy of hybrid beans (some fields private and some not).
  • support copy of Java Records.
  • support copy of Java beans without getter and setter methods.
  • support copy with Java primitive type.
  • support copy with Java Collection type. e.g. List<BeanA> => List<BeanB>
  • support copy with nested map fields. e.g. Map<String, Map<String, String>>
  • support copy with array containing primitive types. e.g. String[] => String[]
  • support copy with an array type. e.g. BeanA[] => BeanB[]
  • support copy with property name mapping. e.g. int id => int userId
  • support copy with recursion copy.
  • support validation through annotations.
  • support copy of beans with different field's name.
  • support lambda function field transformation.
  • support copy of java bean built through Builder.
  • easy usage, declarative way to define the property mapping (in case of different names), or simply adding the Lombok annotations.
  • allows setting the default value for all objects not existing in the source object.
  • allows skipping transformation for a given set of fields.
  • supports the retrieval of the value from getters if a field does not exist in the source object.
  • supports the automatic conversion of primitive types.

Feature samples

Bean transformation samples

Simple case:

public class FromBean {                                     public class ToBean {
    private final String name;                                  @NotNull
    private final BigInteger id;                                public BigInteger id;
    private final List<FromSubBean> subBeanList;                private final String name;
    private List<String> list;                                  private final List<String> list;
    private final FromSubBean subObject;                        private final List<ToSubBean> subBeanList;
    private ImmutableToSubFoo subObject;

    // all constructors                                         // all args constructor
    // getters and setters...                                   // getters and setters... 
}    

And one line code as:

ToBean toBean = beanUtils.getTransformer().transform(fromBean, ToBean.class);

Different field names copy:

From class and To class with different field names:

public class FromBean {                                     public class ToBean {

    private final String name;                                  private final String differentName;
    private final int id;                                       private final int id;
    private final List<FromSubBean> subBeanList;                private final List<ToSubBean> subBeanList;
    private final List<String> list;                            private final List<String> list;
    private final FromSubBean subObject;                        private final ToSubBean subObject;

    // getters...
    public ToBean(final String differentName,
                  final int id,
}                                                                       final List<ToSubBean> subBeanList,
    final List<String> list,
    final ToSubBean subObject) {
        th

Related Skills

View on GitHub
GitHub Stars197
CategoryDevelopment
Updated22h ago
Forks43

Languages

Java

Security Score

100/100

Audited on Apr 1, 2026

No findings