001// Licensed under the Apache License, Version 2.0 (the "License"); 002// you may not use this file except in compliance with the License. 003// You may obtain a copy of the License at 004// 005// http://www.apache.org/licenses/LICENSE-2.0 006// 007// Unless required by applicable law or agreed to in writing, software 008// distributed under the License is distributed on an "AS IS" BASIS, 009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 010// See the License for the specific language governing permissions and 011// limitations under the License. 012 013package org.apache.tapestry5.services; 014 015import org.apache.tapestry5.ioc.annotations.UsesMappedConfiguration; 016import org.apache.tapestry5.ioc.annotations.UsesOrderedConfiguration; 017import org.apache.tapestry5.ioc.services.PropertyAdapter; 018 019/** 020 * Used by {@link BeanModelSource} to identify the type of data associated with a particular property (represented as a 021 * {@link PropertyAdapter}). The data type is a string used to determine what kind of interface to use for displaying 022 * the value of the property, or what kind of interface to use for editing the value of the property. Common property 023 * types are "text", "enum", "checkbox", but the list is extensible. 024 * 025 * Different strategies for identifying the data type are encapsulated in the DataTypeAnalyzer service, forming a 026 * chain of command. 027 * 028 * The DefaultDataTypeAnalyzer service maps property types to data type names. 029 * 030 * The DataTypeAnalyzer service is an extensible {@linkplain org.apache.tapestry5.ioc.services.ChainBuilder chain of 031 * command}), that (by default) includes {@link org.apache.tapestry5.internal.services.AnnotationDataTypeAnalyzer} and 032 * the {@link org.apache.tapestry5.internal.services.DefaultDataTypeAnalyzer} service (ordered last). It uses an ordered configuration. 033 * 034 * @see org.apache.tapestry5.corelib.components.Grid 035 * @see org.apache.tapestry5.corelib.components.BeanEditForm 036 * @see BeanBlockSource 037 */ 038@UsesOrderedConfiguration(DataTypeAnalyzer.class) 039@UsesMappedConfiguration(key = Class.class, value = String.class) 040public interface DataTypeAnalyzer 041{ 042 /** 043 * Identifies the data type, if known, or returns null if not known. 044 */ 045 String identifyDataType(PropertyAdapter adapter); 046}