001 // Copyright 2007 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.services;
016
017 import org.apache.tapestry.corelib.components.BeanEditForm;
018 import org.apache.tapestry.corelib.components.Grid;
019 import org.apache.tapestry.ioc.services.PropertyAdapter;
020
021 /**
022 * Used by {@link BeanModelSource} to identify the type of data associated with a particular property (represented as a
023 * {@link PropertyAdapter}). The data type is a string used to determine what kind of interface to use for displaying
024 * the value of the property, or what kind of interface to use for editing the value of the property. Common property
025 * types are "text", "enum", "checkbox", but the list is extensible.
026 * <p/>
027 * <p>Different strategies for identifying the data type are encapsulated in the DataTypeAnalyzer service, forming a
028 * chain of command.
029 *
030 * @see Grid
031 * @see BeanEditForm
032 * @see BeanBlockSource
033 * @see org.apache.tapestry.services.TapestryModule#contributeDataTypeAnalyzer(org.apache.tapestry.ioc.OrderedConfiguration,
034 * DataTypeAnalyzer)
035 */
036 public interface DataTypeAnalyzer
037 {
038 /**
039 * Identifies the data type, if known, or returns null if not known.
040 */
041 String identifyDataType(PropertyAdapter adapter);
042 }