001    /*
002     * Copyright 2011-2012 UnboundID Corp.
003     *
004     * This program is free software; you can redistribute it and/or modify
005     * it under the terms of the GNU General Public License (GPLv2 only)
006     * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
007     * as published by the Free Software Foundation.
008     *
009     * This program is distributed in the hope that it will be useful,
010     * but WITHOUT ANY WARRANTY; without even the implied warranty of
011     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012     * GNU General Public License for more details.
013     *
014     * You should have received a copy of the GNU General Public License
015     * along with this program; if not, see <http://www.gnu.org/licenses>.
016     */
017    
018    package com.unboundid.scim.data;
019    
020    import com.unboundid.scim.schema.ResourceDescriptor;
021    import com.unboundid.scim.sdk.SCIMObject;
022    
023    /**
024     * Factory interface for creating SCIM resource instances for a given resource
025     * descriptor.
026     */
027    public interface ResourceFactory<R extends BaseResource>
028    {
029      /**
030       * Creates a new SCIM resource instance from a <code>SCIMObject</code>for
031       * the specified resource descriptor.
032       *
033       * @param resourceDescriptor The resource descriptor for the SCIM resource
034       *                           instance.
035       * @param scimObject         The <code>SCIMObject</code> containing all the
036       *                           SCIM attributes and their values.
037       * @return                   A new SCIM resource instance.
038       */
039      R createResource(ResourceDescriptor resourceDescriptor,
040                              SCIMObject scimObject);
041    }