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.math.BigDecimal; 27 import java.net.URI; 28 import net.jcip.annotations.ThreadSafe; 29 import org.modeshape.graph.query.model.TypeSystem; 30 31 /** 32 * The set of standard {@link ValueFactory} instances. 33 */ 34 @ThreadSafe 35 public interface ValueFactories extends Iterable<ValueFactory<?>> { 36 37 /** 38 * Get the type system associated with these factories. 39 * 40 * @return the type system; never null 41 */ 42 TypeSystem getTypeSystem(); 43 44 /** 45 * Get the value factory that creates values of the supplied {@link PropertyType type}. 46 * 47 * @param type the type for the values 48 * @return the factory; never null 49 * @throws IllegalArgumentException if the property type is null 50 */ 51 ValueFactory<?> getValueFactory( PropertyType type ); 52 53 /** 54 * Get the value factory that is best able to create values with the most natural type given by the supplied value. 55 * 56 * @param prototype the value that should be used to determine the best value factory 57 * @return the factory; never null 58 * @throws IllegalArgumentException if the prototype value is null 59 */ 60 ValueFactory<?> getValueFactory( Object prototype ); 61 62 /** 63 * Get the value factory for {@link PropertyType#STRING string} properties. 64 * 65 * @return the factory; never null 66 */ 67 ValueFactory<String> getStringFactory(); 68 69 /** 70 * Get the value factory for {@link PropertyType#BINARY binary} properties. 71 * 72 * @return the factory; never null 73 */ 74 BinaryFactory getBinaryFactory(); 75 76 /** 77 * Get the value factory for {@link PropertyType#LONG long} properties. 78 * 79 * @return the factory; never null 80 */ 81 ValueFactory<Long> getLongFactory(); 82 83 /** 84 * Get the value factory for {@link PropertyType#DOUBLE double} properties. 85 * 86 * @return the factory; never null 87 */ 88 ValueFactory<Double> getDoubleFactory(); 89 90 /** 91 * Get the value factory for {@link PropertyType#DECIMAL decimal} properties. 92 * 93 * @return the factory; never null 94 */ 95 ValueFactory<BigDecimal> getDecimalFactory(); 96 97 /** 98 * Get the value factory for {@link PropertyType#DATE date} properties. 99 * 100 * @return the factory; never null 101 */ 102 DateTimeFactory getDateFactory(); 103 104 /** 105 * Get the value factory for {@link PropertyType#BOOLEAN boolean} properties. 106 * 107 * @return the factory; never null 108 */ 109 ValueFactory<Boolean> getBooleanFactory(); 110 111 /** 112 * Get the value factory for {@link PropertyType#NAME name} properties. 113 * 114 * @return the factory; never null 115 */ 116 NameFactory getNameFactory(); 117 118 /** 119 * Get the value factory for {@link PropertyType#REFERENCE reference} properties. 120 * 121 * @return the factory; never null 122 */ 123 ValueFactory<Reference> getReferenceFactory(); 124 125 /** 126 * Get the value factory for {@link PropertyType#PATH path} properties. 127 * 128 * @return the factory; never null 129 */ 130 PathFactory getPathFactory(); 131 132 /** 133 * Get the value factory for {@link PropertyType#URI URI} properties. 134 * 135 * @return the factory; never null 136 */ 137 ValueFactory<URI> getUriFactory(); 138 139 /** 140 * Get the value factory for {@link PropertyType#UUID UUID} properties. 141 * 142 * @return the factory; never null 143 */ 144 UuidFactory getUuidFactory(); 145 146 /** 147 * Get the value factory for {@link PropertyType#OBJECT object} properties. 148 * 149 * @return the factory; never null 150 */ 151 ValueFactory<Object> getObjectFactory(); 152 153 }