001 /*
002 * Copyright 2002-2004 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005 * use this file except in compliance with the License. You may obtain a copy of
006 * the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013 * License for the specific language governing permissions and limitations under
014 * the License.
015 */
016 package org.springframework.binding;
017
018 import java.util.Map;
019
020 /**
021 * Simple interface for accessing metadata about a particular property.
022 *
023 * @author Keith Donald
024 */
025 public interface PropertyMetadataAccessStrategy {
026
027 /**
028 * Determine if the given property is readable.
029 *
030 * @param propertyName property to examine.
031 * @return <code>true</code> if the property is readable.
032 */
033 boolean isReadable(String propertyName);
034
035 /**
036 * Determine if the given property is writeable.
037 *
038 * @param propertyName property to examine.
039 * @return <code>true</code> if the property is writeable.
040 */
041 boolean isWriteable(String propertyName);
042
043 /**
044 * Get the type of the given property.
045 *
046 * @param propertyName property to examine.
047 * @return the type of the property.
048 */
049 Class getPropertyType(String propertyName);
050
051 /**
052 * Returns custom metadata that may be associated with the specified
053 * property path.
054 *
055 * @param propertyName property to examine.
056 * @param key used to retreive the metadata.
057 * @return Object stored under the given key.
058 */
059 Object getUserMetadata(String propertyName, String key);
060
061 /**
062 * Returns all custom metadata associated with the specified property in the
063 * form of a Map.
064 *
065 * @param propertyName property to examine.
066 * @return Map containing String keys - this method may or may not return
067 * <code>null</code> if there is no custom metadata associated with the
068 * property.
069 */
070 Map getAllUserMetadata(String propertyName);
071 }