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} to create Tapestry 024 * domain objects. 025 * <p> 026 * The default implementation here creates the expected runtime instances of classes in packages: 027 * <ul> 028 * <li>org.apache.tapestry.spec</li> 029 * <li>org.apache.tapestry.bean</li> 030 * </ul> 031 * <p> 032 * This class is extended by Spindle - the Eclipse Plugin for Tapestry 033 * 034 * @author GWL 035 * @since 1.0.9 036 */ 037 038 public class SpecFactory 039 { 040 /** 041 * Creates a concrete instance of {@link ApplicationSpecification}. 042 */ 043 044 public IApplicationSpecification createApplicationSpecification() 045 { 046 return new ApplicationSpecification(); 047 } 048 049 /** 050 * Creates an instance of {@link LibrarySpecification}. 051 * 052 * @since 2.2 053 */ 054 055 public ILibrarySpecification createLibrarySpecification() 056 { 057 return new LibrarySpecification(); 058 } 059 060 /** 061 * Returns a new instance of {@link IAssetSpecification}. 062 * 063 * @since 3.0 064 */ 065 066 public IAssetSpecification createAssetSpecification() 067 { 068 return new AssetSpecification(); 069 } 070 071 /** 072 * Creates a new instance of {@link IBeanSpecification}. 073 * 074 * @since 3.0 075 */ 076 077 public IBeanSpecification createBeanSpecification() 078 { 079 return new BeanSpecification(); 080 } 081 082 public IBindingSpecification createBindingSpecification() 083 { 084 return new BindingSpecification(); 085 } 086 087 /** 088 * Creates a new concrete instance of {@link IListenerBindingSpecification}for the given 089 * language (which is option) and script. 090 * 091 * @since 3.0 092 */ 093 094 public IListenerBindingSpecification createListenerBindingSpecification() 095 { 096 return new ListenerBindingSpecification(); 097 } 098 099 /** 100 * Creates a concrete instance of {@link IComponentSpecification}. 101 */ 102 103 public IComponentSpecification createComponentSpecification() 104 { 105 return new ComponentSpecification(); 106 } 107 108 /** 109 * Creates a concrete instance of {@link IContainedComponent}. 110 */ 111 112 public IContainedComponent createContainedComponent() 113 { 114 return new ContainedComponent(); 115 } 116 117 /** 118 * Creates a concrete instance of {@link ParameterSpecification}. 119 */ 120 121 public IParameterSpecification createParameterSpecification() 122 { 123 return new ParameterSpecification(); 124 } 125 126 127 /** @since 4.0 */ 128 public BindingBeanInitializer createBindingBeanInitializer(BindingSource source) 129 { 130 return new BindingBeanInitializer(source); 131 } 132 133 /** 134 * Creates a concrete instance of {@link org.apache.tapestry.spec.IExtensionSpecification}. 135 * 136 * @since 2.2 137 */ 138 139 public IExtensionSpecification createExtensionSpecification(ClassResolver resolver, 140 ValueConverter valueConverter) 141 { 142 return new ExtensionSpecification(resolver, valueConverter); 143 } 144 145 /** 146 * Creates a concrete instance of {@link org.apache.tapestry.spec.IPropertySpecification}. 147 * 148 * @since 3.0 149 */ 150 151 public IPropertySpecification createPropertySpecification() 152 { 153 return new PropertySpecification(); 154 } 155 156 /** @since 4.0 */ 157 public InjectSpecification createInjectSpecification() 158 { 159 return new InjectSpecificationImpl(); 160 } 161 }