/*
 * Copyright 2020 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.optaplanner.persistence.jsonb.api;

import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import javax.json.bind.JsonbConfig;

import org.optaplanner.persistence.jsonb.api.score.buildin.bendable.BendableScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.bendablebigdecimal.BendableBigDecimalScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.bendablelong.BendableLongScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.hardmediumsoft.HardMediumSoftScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.hardmediumsoftbigdecimal.HardMediumSoftBigDecimalScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.hardmediumsoftlong.HardMediumSoftLongScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.hardsoft.HardSoftScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.hardsoftbigdecimal.HardSoftBigDecimalScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.hardsoftdouble.HardSoftDoubleScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.hardsoftlong.HardSoftLongScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.simple.SimpleScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.simplebigdecimal.SimpleBigDecimalScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.simpledouble.SimpleDoubleScoreJsonbAdapter;
import org.optaplanner.persistence.jsonb.api.score.buildin.simplelong.SimpleLongScoreJsonbAdapter;

/**
 * This class adds all JSON-B adapters.
 *
 */
public class OptaPlannerJsonbConfig {

    /**
     * @return never null, use it to create a {@link Jsonb} instance with {@link JsonbBuilder#create(JsonbConfig)}.
     */
    public static JsonbConfig createConfig() {
        JsonbConfig config = new JsonbConfig()
                .withAdapters(new BendableScoreJsonbAdapter(),
                              new BendableBigDecimalScoreJsonbAdapter(),
                              new BendableLongScoreJsonbAdapter(),
                              new HardMediumSoftScoreJsonbAdapter(),
                              new HardMediumSoftBigDecimalScoreJsonbAdapter(),
                              new HardMediumSoftLongScoreJsonbAdapter(),
                              new HardSoftScoreJsonbAdapter(),
                              new HardSoftBigDecimalScoreJsonbAdapter(),
                              new HardSoftDoubleScoreJsonbAdapter(),
                              new HardSoftLongScoreJsonbAdapter(),
                              new SimpleScoreJsonbAdapter(),
                              new SimpleBigDecimalScoreJsonbAdapter(),
                              new SimpleDoubleScoreJsonbAdapter(),
                              new SimpleLongScoreJsonbAdapter());

        return config;
    }
}

@@ -765,16 +765,61 @@
 bConfig;
+%0Aimport javax.json.bind.adapter.JsonbAdapter;
 %0A%0Aimport
@@ -2343,19 +2343,16 @@
 apters.%0A
- *%0A
  */%0Apubl
@@ -3574,16 +3574,16 @@
 er());%0A%0A
-
         
@@ -3602,11 +3602,1026 @@
 g;%0A    %7D
+%0A%0A    /**%0A     * @return never null, use it to customize a %7B@link JsonbConfig%7D instance with %7B@link JsonbConfig#withAdapters(JsonbAdapter%5B%5D)%7D.%0A     */%0A    public static JsonbAdapter%5B%5D getScoreJsonbAdapters() %7B%0A        return new JsonbAdapter%5B%5D%7B%0A                new BendableScoreJsonbAdapter(),%0A                new BendableBigDecimalScoreJsonbAdapter(),%0A                new BendableLongScoreJsonbAdapter(),%0A                new HardMediumSoftScoreJsonbAdapter(),%0A                new HardMediumSoftBigDecimalScoreJsonbAdapter(),%0A                new HardMediumSoftLongScoreJsonbAdapter(),%0A                new HardSoftScoreJsonbAdapter(),%0A                new HardSoftBigDecimalScoreJsonbAdapter(),%0A                new HardSoftDoubleScoreJsonbAdapter(),%0A                new HardSoftLongScoreJsonbAdapter(),%0A                new SimpleScoreJsonbAdapter(),%0A                new SimpleBigDecimalScoreJsonbAdapter(),%0A                new SimpleDoubleScoreJsonbAdapter(),%0A                new SimpleLongScoreJsonbAdapter()%7D;%0A    %7D
 %0A%7D%0A

Add getScoreJsonbAdapters() to OptaPlannerJsonbConfig class