001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License.
018 */
019
020package org.apache.isis.core.metamodel.services.container.query;
021
022import java.io.Serializable;
023
024import org.apache.isis.applib.query.Query;
025import org.apache.isis.applib.query.QueryBuiltInAbstract;
026
027/**
028 * Although implements {@link Query} and thus is ought to be
029 * {@link Serializable}, it will be converted into a <tt>PersistenceQuery</tt>
030 * in the runtime for remoting purposes and so does not need to be (and indeed
031 * isn't).
032 * 
033 * <p>
034 * See discussion in {@link QueryBuiltInAbstract} for further details.
035 */
036public class QueryFindByPattern<T> extends QueryBuiltInAbstract<T> {
037
038    private static final long serialVersionUID = 1L;
039
040    private final T pattern;
041    
042    public QueryFindByPattern(final Class<T> type, final T pattern, final long ... range){
043        super(type, range);
044        this.pattern = pattern;
045    }
046
047
048    public T getPattern() {
049        return pattern;
050    }
051
052    @Override
053    public String getDescription() {
054        return getResultTypeName() + " (matching pattern)";
055    }
056
057}