01: // Copyright 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.services;
16:
17: import org.apache.tapestry.ComponentResources;
18: import org.apache.tapestry.beaneditor.BeanModel;
19: import org.apache.tapestry.beaneditor.Order;
20:
21: /**
22: * Used by a component to create a default {@link BeanModel} for a particular bean class. Also
23: * provides support to the model by generating validation information for individual fields.
24: */
25: public interface BeanModelSource {
26: /**
27: * Creates a new model used for editting the indicated bean class. The model will represent all
28: * read/write properties of the bean. The order of the properties is defined by the
29: * {@link Order} annotation on the getter or setter methods. The labels for the properties are
30: * derived from the property names, but if the component's message catalog has keys of the form
31: * <code>propertyName-label</code>, then those will be used instead.
32: * <p>
33: * Models are <em>mutable</em>, so they are not cached, a fresh instance is created each
34: * time.
35: *
36: * @param beanClass
37: * class of object to be editted
38: * @param filterReadOnlyProperties
39: * if true, then properties that are read-only will be skipped (leaving only
40: * read-write properties). If false, then both read-only and read-write properties
41: * will be included.
42: * @param resources
43: * used when resolving resources, especially component messages (used to access
44: * labels)
45: * @return a model
46: */
47: BeanModel create(Class beanClass, boolean filterReadOnlyProperties,
48: ComponentResources resources);
49: }
|