/*
 * 
 * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
 * 
 * The contents of this file are subject to the Sun Community Source
 * License v3.0/Jini Technology Specific Attachment v 1.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://wwws.sun.com/software/jini/licensing/SCSL3_JiniTSA1.html.
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights and limitations
 * under the License.
 * 
 * The Reference Code is Jini Technology Core Platform code, v2.0. The
 * Developer of the Reference Code is Sun Microsystems, Inc.
 * 
 * Contributor(s): Sun Microsystems, Inc.
 * 
 */
package net.jini.core.lookup;

import net.jini.core.entry.Entry;

/**
 * Items in the lookup service are matched using instance of this class.
 * A service item (item) matches a service template (tmpl) if:
 * item.serviceID equals tmpl.serviceID (or if tmpl.serviceID is null);
 * and item.service is an instance of every type in tmpl.serviceTypes; and
 * item.attributeSets contains at least one matching entry for each entry
 * template in tmpl.attributeSetTemplates.
 * <p>
 * An entry matches
 * an entry template if the class of the template is the same as, or a
 * superclass of, the class of the entry, and every non-null field in the
 * template equals the corresponding field of the entry.  Every entry can be
 * used to match more than one template.  Note that in a service template,
 * for serviceTypes and attributeSetTemplates, a null field is equivalent to
 * an empty array; both represent a wildcard.
 *
 * @author Sun Microsystems, Inc.
 *
 * @since 1.0
 */
public class ServiceTemplate implements java.io.Serializable {

    private static final long serialVersionUID = 7854483807886483216L;

    /**
     * Service ID to match, or <tt>null</tt>.
     *
     * @serial
     */
    public ServiceID serviceID;
    /**
     * Service types to match, or <tt>null</tt>.
     *
     * @serial
     */
    public Class[] serviceTypes;
    /**
     * Attribute set templates to match, or <tt>null</tt>.
     *
     * @serial
     */
    public Entry[] attributeSetTemplates;

    /**
     * Simple constructor.
     *
     * @param serviceID service ID to match, or null
     * @param serviceTypes service types to match, or null
     * @param attrSetTemplates attribute set templates to match, or null
     */
    public ServiceTemplate(ServiceID serviceID,
			   Class[] serviceTypes,
			   Entry[] attrSetTemplates) {
	this.serviceID = serviceID;
	this.serviceTypes = serviceTypes;
	this.attributeSetTemplates = attrSetTemplates;
    }
}
