View Javadoc

1   /*
2    * ModeShape (http://www.modeshape.org)
3    * See the COPYRIGHT.txt file distributed with this work for information
4    * regarding copyright ownership.  Some portions may be licensed
5    * to Red Hat, Inc. under one or more contributor license agreements.
6    * See the AUTHORS.txt file in the distribution for a full listing of 
7    * individual contributors. 
8    *
9    * ModeShape is free software. Unless otherwise indicated, all code in ModeShape
10   * is licensed to you under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation; either version 2.1 of
12   * the License, or (at your option) any later version.
13   *
14   * ModeShape is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this software; if not, write to the Free
21   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
23   */
24  package org.modeshape.graph.property;
25  
26  import java.util.Iterator;
27  import net.jcip.annotations.ThreadSafe;
28  
29  /**
30   * A factory for creating {@link Property} objects.
31   */
32  @ThreadSafe
33  public interface PropertyFactory {
34      /**
35       * Create a property with the supplied name and values
36       * 
37       * @param name the property name; may not be null
38       * @param values the values
39       * @return the resulting property
40       */
41      Property create( Name name,
42                       Object... values );
43  
44      /**
45       * Create a property with the supplied name and values
46       * 
47       * @param name the property name; may not be null
48       * @param values the values
49       * @return the resulting property
50       */
51      Property create( Name name,
52                       Iterable<?> values );
53  
54      /**
55       * Create a property with the supplied name and values
56       * 
57       * @param name the property name; may not be null
58       * @param values the values
59       * @return the resulting property
60       */
61      Property create( Name name,
62                       Iterator<?> values );
63  
64      /**
65       * Create a property with the supplied name and values
66       * 
67       * @param name the property name; may not be null
68       * @param desiredType the type that the objects should be converted to; if null, they will be used as is
69       * @param values the values
70       * @return the resulting property
71       */
72      Property create( Name name,
73                       PropertyType desiredType,
74                       Object... values );
75  
76      /**
77       * Create a property with the supplied name and values
78       * 
79       * @param name the property name; may not be null
80       * @param desiredType the type that the objects should be converted to; if null, they will be used as is
81       * @param values the values
82       * @return the resulting property
83       */
84      Property create( Name name,
85                       PropertyType desiredType,
86                       Iterable<?> values );
87  
88      /**
89       * Create a property with the supplied name and values
90       * 
91       * @param name the property name; may not be null
92       * @param desiredType the type that the objects should be converted to; if null, they will be used as is
93       * @param values the values
94       * @return the resulting property
95       */
96      Property create( Name name,
97                       PropertyType desiredType,
98                       Iterator<?> values );
99  
100     /**
101      * Create a property with the supplied name and {@link Path} value. This method is provided because Path implements
102      * Iterable&lt;Segment>.
103      * 
104      * @param name the property name; may not be null
105      * @param value the path value
106      * @return the resulting property
107      */
108     Property create( Name name,
109                      Path value );
110 }