All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.algorithmx.rules.bind.BindingMatchingStrategy Maven / Gradle / Ivy

There is a newer version: 0.79.50
Show newest version
/**
 * This software is licensed under the Apache 2 license, quoted below.
 *
 * Copyright (c) 1999-2019, Live Software & Consultants Inc ([email protected])
 *
 * 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.algorithmx.rules.bind;

import java.util.Set;

/**
 * Strategy class that matches Bindings to a desired criteria.
 *
 * @author Max Arulananthan
 * @since 1.0
 */
public interface BindingMatchingStrategy {

    /**
     * Returns a set a Bindings that match a set criteria that is determined by the implementing class.
     *
     * @param bindings bindings.
     * @param name desired name.
     * @param  generic type of the Binding.
     * @return Bindings that match the criteria.
     */
    default  Set> match(Bindings bindings, String name) {
        return match(bindings, name, (TypeReference) null);
    }

    /**
     * Returns a set a Bindings that match a set criteria that is determined by the implementing class.
     *
     * @param bindings bindings.
     * @param name desired name.
     * @param type desired type.
     * @param  generic type of the Binding.
     * @return Bindings that match the criteria.
     */
    default  Set> match(Bindings bindings, String name, Class type) {
        return match(bindings, name, TypeReference.with(type));
    }

    /**
     * Returns a set a Bindings that match a set criteria that is determined by the implementing class.
     *
     * @param bindings bindings.
     * @param name desired name.
     * @param type desired type.
     * @param  generic type of the Binding.
     * @return Bindings that match the criteria.
     */
     Set> match(Bindings bindings, String name, TypeReference type);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy