001 // Copyright 2004, 2005 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry.spec; 016 017 import org.apache.hivemind.ClassResolver; 018 import org.apache.tapestry.bean.BindingBeanInitializer; 019 import org.apache.tapestry.binding.BindingSource; 020 import org.apache.tapestry.coerce.ValueConverter; 021 022 /** 023 * A Factory used by {@link org.apache.tapestry.parse.SpecificationParser} 024 * to create Tapestry domain objects. 025 * <p> 026 * The default implementation here creates the expected runtime instances of 027 * classes in packages: 028 * <ul> 029 * <li>org.apache.tapestry.spec</li> 030 * <li>org.apache.tapestry.bean</li> 031 * </ul> 032 * <p> 033 * This class is extended by Spindle - the Eclipse Plugin for Tapestry 034 * 035 * @author GWL 036 * @since 1.0.9 037 */ 038 039 public class SpecFactory 040 { 041 042 /** 043 * Creates a concrete instance of {@link ApplicationSpecification}. 044 */ 045 046 public IApplicationSpecification createApplicationSpecification() 047 { 048 return new ApplicationSpecification(); 049 } 050 051 /** 052 * Creates an instance of {@link LibrarySpecification}. 053 * 054 * @since 2.2 055 */ 056 057 public ILibrarySpecification createLibrarySpecification() 058 { 059 return new LibrarySpecification(); 060 } 061 062 /** 063 * Returns a new instance of {@link IAssetSpecification}. 064 * 065 * @since 3.0 066 */ 067 068 public IAssetSpecification createAssetSpecification() 069 { 070 return new AssetSpecification(); 071 } 072 073 /** 074 * Creates a new instance of {@link IBeanSpecification}. 075 * 076 * @since 3.0 077 */ 078 079 public IBeanSpecification createBeanSpecification() 080 { 081 return new BeanSpecification(); 082 } 083 084 public IBindingSpecification createBindingSpecification() 085 { 086 return new BindingSpecification(); 087 } 088 089 /** 090 * Creates a concrete instance of {@link IComponentSpecification}. 091 */ 092 093 public IComponentSpecification createComponentSpecification() 094 { 095 return new ComponentSpecification(); 096 } 097 098 /** 099 * Creates a concrete instance of {@link IContainedComponent}. 100 */ 101 102 public IContainedComponent createContainedComponent() 103 { 104 return new ContainedComponent(); 105 } 106 107 /** 108 * Creates a concrete instance of {@link ParameterSpecification}. 109 */ 110 111 public IParameterSpecification createParameterSpecification() 112 { 113 return new ParameterSpecification(); 114 } 115 116 /** @since 4.0 */ 117 public BindingBeanInitializer createBindingBeanInitializer( 118 BindingSource source) 119 { 120 return new BindingBeanInitializer(source); 121 } 122 123 /** 124 * Creates a concrete instance of 125 * {@link org.apache.tapestry.spec.IExtensionSpecification}. 126 * 127 * @since 2.2 128 */ 129 130 public IExtensionSpecification createExtensionSpecification( 131 ClassResolver resolver, ValueConverter valueConverter) 132 { 133 return new ExtensionSpecification(resolver, valueConverter); 134 } 135 136 /** 137 * Creates a concrete instance of 138 * {@link org.apache.tapestry.spec.IPropertySpecification}. 139 * 140 * @since 3.0 141 */ 142 143 public IPropertySpecification createPropertySpecification() 144 { 145 return new PropertySpecification(); 146 } 147 148 /** @since 4.0 */ 149 public InjectSpecification createInjectSpecification() 150 { 151 return new InjectSpecificationImpl(); 152 } 153 }