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