LICENSE4J
Home rarr Documents rarr Licensing Library rarr License Builder

License Builder

The Singleton design pattern has been utilized to develop the licensing library. The License class encompasses all necessary methods and inner classes. The method License.getLicense().getBuilder() returns a Builder class, which is used to define the product hash value, license file, license registry location, and any required features.

// The only required parameter is product hash code
// given on license server Products page.
// Following is the minimal code to build the
// License instance. Default values for file
// and registry will be used.
License.getInstance().getBuilder()
        .product("product-hash-code")
        .build();


// Following code use all parameters. file and registry
// used at the same time, so file location will be used
// on non-Windows systems, on Windows system registry will
// be used.
License.getInstance().getBuilder()
        .product("product-hash-code")
        .file(System.getProperty("user.home") + "/MyProduct/license.l4j")
        .registry(MyProduct\\license)
        .feature("edition", "pro", License.FeatureComparator.STRING_EQUALS)
        .feature("version", "1.2.3", License.FeatureComparator.STRING_STARTS_WITH)
        .build();

Home rarr Documents rarr License Library rarr License Builder