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

io.logspace.agent.shaded.quartz.impl.matchers.GroupMatcher Maven / Gradle / Ivy

There is a newer version: 0.3.2
Show newest version
/*
 * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
 * 
 * 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 io.logspace.agent.shaded.quartz.impl.matchers;

import io.logspace.agent.shaded.quartz.JobKey;
import io.logspace.agent.shaded.quartz.TriggerKey;
import io.logspace.agent.shaded.quartz.utils.Key;

/**
 * Matches on group (ignores name) property of Keys.
 *  
 * @author jhouse
 */
public class GroupMatcher> extends StringMatcher {
  
    private static final long serialVersionUID = -3275767650469343849L;

    protected GroupMatcher(String compareTo, StringOperatorName compareWith) {
        super(compareTo, compareWith);
    }
    
    /**
     * Create a GroupMatcher that matches groups equaling the given string.
     */
    public static > GroupMatcher groupEquals(String compareTo) {
        return new GroupMatcher(compareTo, StringOperatorName.EQUALS);
    }

    /**
     * Create a GroupMatcher that matches job groups equaling the given string.
     */
    public static GroupMatcher jobGroupEquals(String compareTo) {
        return GroupMatcher.groupEquals(compareTo);
    }
    
    /**
     * Create a GroupMatcher that matches trigger groups equaling the given string.
     */
    public static GroupMatcher triggerGroupEquals(String compareTo) {
        return GroupMatcher.groupEquals(compareTo);
    }
    
    /**
     * Create a GroupMatcher that matches groups starting with the given string.
     */
    public static > GroupMatcher groupStartsWith(String compareTo) {
        return new GroupMatcher(compareTo, StringOperatorName.STARTS_WITH);
    }

    /**
     * Create a GroupMatcher that matches job groups starting with the given string.
     */
    public static GroupMatcher jobGroupStartsWith(String compareTo) {
        return GroupMatcher.groupStartsWith(compareTo);
    }
    
    /**
     * Create a GroupMatcher that matches trigger groups starting with the given string.
     */
    public static GroupMatcher triggerGroupStartsWith(String compareTo) {
        return GroupMatcher.groupStartsWith(compareTo);
    }

    /**
     * Create a GroupMatcher that matches groups ending with the given string.
     */
    public static > GroupMatcher groupEndsWith(String compareTo) {
        return new GroupMatcher(compareTo, StringOperatorName.ENDS_WITH);
    }

    /**
     * Create a GroupMatcher that matches job groups ending with the given string.
     */
    public static GroupMatcher jobGroupEndsWith(String compareTo) {
        return GroupMatcher.groupEndsWith(compareTo);
    }
    
    /**
     * Create a GroupMatcher that matches trigger groups ending with the given string.
     */
    public static GroupMatcher triggerGroupEndsWith(String compareTo) {
        return GroupMatcher.groupEndsWith(compareTo);
    }
    
    /**
     * Create a GroupMatcher that matches groups containing the given string.
     */
    public static > GroupMatcher groupContains(String compareTo) {
        return new GroupMatcher(compareTo, StringOperatorName.CONTAINS);
    }

    /**
     * Create a GroupMatcher that matches job groups containing the given string.
     */
    public static GroupMatcher jobGroupContains(String compareTo) {
        return GroupMatcher.groupContains(compareTo);
    }
    
    /**
     * Create a GroupMatcher that matches trigger groups containing the given string.
     */
    public static GroupMatcher triggerGroupContains(String compareTo) {
        return GroupMatcher.groupContains(compareTo);
    }

    /**
     * Create a GroupMatcher that matches groups starting with the given string.
     */
    public static > GroupMatcher anyGroup() {
        return new GroupMatcher("", StringOperatorName.ANYTHING);
    }

    /**
     * Create a GroupMatcher that matches job groups starting with the given string.
     */
    public static GroupMatcher anyJobGroup() {
        return GroupMatcher.anyGroup();
    }

    /**
     * Create a GroupMatcher that matches trigger groups starting with the given string.
     */
    public static GroupMatcher anyTriggerGroup() {
        return GroupMatcher.anyGroup();
    }

    @Override
    protected String getValue(T key) {
        return key.getGroup();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy