001 /* 002 * JBoss, Home of Professional Open Source. 003 * Copyright 2008, Red Hat Middleware LLC, and individual contributors 004 * as indicated by the @author tags. See the copyright.txt file in the 005 * distribution for a full listing of individual contributors. 006 * 007 * This is free software; you can redistribute it and/or modify it 008 * under the terms of the GNU Lesser General Public License as 009 * published by the Free Software Foundation; either version 2.1 of 010 * the License, or (at your option) any later version. 011 * 012 * This software is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * You should have received a copy of the GNU Lesser General Public 018 * License along with this software; if not, write to the Free 019 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 020 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 021 */ 022 package org.jboss.dna.graph.properties; 023 024 import java.math.BigDecimal; 025 import java.net.URI; 026 027 /** 028 * The set of standard {@link ValueFactory} instances. 029 * 030 * @author Randall Hauch 031 */ 032 public interface ValueFactories extends Iterable<ValueFactory<?>> { 033 034 /** 035 * Get the value factory that creates values of the supplied {@link PropertyType type}. 036 * 037 * @param type the type for the values 038 * @return the factory; never null 039 * @throws IllegalArgumentException if the property type is null 040 */ 041 ValueFactory<?> getValueFactory( PropertyType type ); 042 043 /** 044 * Get the value factory that is best able to create values with the most natural type given by the supplied value. 045 * 046 * @param prototype the value that should be used to determine the best value factory 047 * @return the factory; never null 048 * @throws IllegalArgumentException if the prototype value is null 049 */ 050 ValueFactory<?> getValueFactory( Object prototype ); 051 052 /** 053 * Get the value factory for {@link PropertyType#STRING string} properties. 054 * 055 * @return the factory; never null 056 */ 057 ValueFactory<String> getStringFactory(); 058 059 /** 060 * Get the value factory for {@link PropertyType#BINARY binary} properties. 061 * 062 * @return the factory; never null 063 */ 064 ValueFactory<Binary> getBinaryFactory(); 065 066 /** 067 * Get the value factory for {@link PropertyType#LONG long} properties. 068 * 069 * @return the factory; never null 070 */ 071 ValueFactory<Long> getLongFactory(); 072 073 /** 074 * Get the value factory for {@link PropertyType#DOUBLE double} properties. 075 * 076 * @return the factory; never null 077 */ 078 ValueFactory<Double> getDoubleFactory(); 079 080 /** 081 * Get the value factory for {@link PropertyType#DECIMAL decimal} properties. 082 * 083 * @return the factory; never null 084 */ 085 ValueFactory<BigDecimal> getDecimalFactory(); 086 087 /** 088 * Get the value factory for {@link PropertyType#DATE date} properties. 089 * 090 * @return the factory; never null 091 */ 092 DateTimeFactory getDateFactory(); 093 094 /** 095 * Get the value factory for {@link PropertyType#BOOLEAN boolean} properties. 096 * 097 * @return the factory; never null 098 */ 099 ValueFactory<Boolean> getBooleanFactory(); 100 101 /** 102 * Get the value factory for {@link PropertyType#NAME name} properties. 103 * 104 * @return the factory; never null 105 */ 106 NameFactory getNameFactory(); 107 108 /** 109 * Get the value factory for {@link PropertyType#REFERENCE reference} properties. 110 * 111 * @return the factory; never null 112 */ 113 ValueFactory<Reference> getReferenceFactory(); 114 115 /** 116 * Get the value factory for {@link PropertyType#PATH path} properties. 117 * 118 * @return the factory; never null 119 */ 120 PathFactory getPathFactory(); 121 122 /** 123 * Get the value factory for {@link PropertyType#URI URI} properties. 124 * 125 * @return the factory; never null 126 */ 127 ValueFactory<URI> getUriFactory(); 128 129 /** 130 * Get the value factory for {@link PropertyType#UUID UUID} properties. 131 * 132 * @return the factory; never null 133 */ 134 UuidFactory getUuidFactory(); 135 136 /** 137 * Get the value factory for {@link PropertyType#OBJECT object} properties. 138 * 139 * @return the factory; never null 140 */ 141 ValueFactory<Object> getObjectFactory(); 142 143 }