2 * Copyright (c) 2012, the Last.fm Java Project and Committers All rights
3 * reserved. Redistribution and use of this software in source and binary forms,
4 * with or without modification, are permitted provided that the following
5 * conditions are met: - Redistributions of source code must retain the above
6 * copyright notice, this list of conditions and the following disclaimer. -
7 * Redistributions in binary form must reproduce the above copyright notice,
8 * this list of conditions and the following disclaimer in the documentation
9 * and/or other materials provided with the distribution. THIS SOFTWARE IS
10 * PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
11 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
13 * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
14 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
15 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
16 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
17 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 package com.cyanogenmod.eleven.lastfm;
25 * An <code>ItemFactory</code> can be used to instantiate a value object - such
26 * as Artist, Album, Track, Tag - from an XML element. Use the
27 * {@link ItemFactoryBuilder} to obtain item factories for a specific type.
29 * @author Janni Kovacs
30 * @see com.cyanogenmod.eleven.lastfm.api.ItemFactoryBuilder
31 * @see ResponseBuilder
33 interface ItemFactory<T> {
36 * Create a new instance of the type <code>T</code>, based on the passed
39 * @param element the XML element
40 * @return a new object
42 public T createItemFromElement(DomElement element);