This commit is contained in:
Keith Donald 2009-07-24 19:32:34 +00:00
parent a6cd69dc7c
commit bbe4c2b611
4 changed files with 22 additions and 9 deletions

View File

@ -18,6 +18,11 @@ package org.springframework.ui.binding.support;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
/**
* A type descriptor for a parameterizable collection type such as a java.util.List<?>.
* @author Keith Donald
* @since 3.0
*/
public class CollectionTypeDescriptor {
private Class<?> type;
@ -38,7 +43,7 @@ public class CollectionTypeDescriptor {
}
/**
* The element type.
* The parameterized collection element type.
*/
public Class<?> getElementType() {
return elementType;

View File

@ -41,6 +41,11 @@ import org.springframework.ui.format.Formatter;
import org.springframework.ui.message.MessageBuilder;
import org.springframework.ui.message.ResolvableArgument;
/**
* Default FieldModel implementation suitable for use in most environments.
* @author Keith Donald
* @since 3.0
*/
public class DefaultFieldModel implements FieldModel {
private ValueModel valueModel;

View File

@ -32,20 +32,19 @@ import org.springframework.core.convert.support.DefaultTypeConverter;
import org.springframework.ui.binding.FieldModel;
import org.springframework.ui.binding.FieldNotFoundException;
import org.springframework.ui.binding.PresentationModel;
import org.springframework.ui.binding.binder.Binder;
import org.springframework.ui.binding.config.FieldModelConfiguration;
import org.springframework.ui.binding.config.Condition;
import org.springframework.ui.binding.config.FieldModelConfiguration;
import org.springframework.ui.format.Formatter;
import org.springframework.util.Assert;
/**
* A generic {@link Binder binder} suitable for use in most environments.
* A default PresentationModel implementation suitable for use in most environments.
* @author Keith Donald
* @since 3.0
* @see #setFormatterRegistry(FormatterRegistry)
* @see #setMessageSource(MessageSource)
* @see #setTypeConverter(TypeConverter)
* @see #bind(Map)
* @see #field(String)
*/
public class DefaultPresentationModel implements PresentationModel {
@ -103,9 +102,9 @@ public class DefaultPresentationModel implements PresentationModel {
}
/**
* Add a a new FieldModelRule for the property at the path specified.
* @param propertyPath binding rule property path in format prop.nestedProp
* @return a builder for the binding rule
* Add a FieldModel rule at the domain object property path.
* @param propertyPath the domain object property path in format &lt;prop&gt;[.nestedProp]
* @return a builder for the field model configuration
*/
public FieldModelConfiguration field(String propertyPath) {
FieldPath path = new FieldPath(propertyPath);
@ -116,6 +115,9 @@ public class DefaultPresentationModel implements PresentationModel {
return rule;
}
/**
* The domain-layer model this presentation model coordinates with.
*/
public Object getDomainModel() {
return domainModel;
}

View File

@ -22,8 +22,9 @@ import org.springframework.ui.binding.PresentationModel;
import org.springframework.ui.binding.PresentationModelFactory;
/**
* BindingFactoryLocator implementation that uses a {@link IdentityHashMap} to map models to BindingFactories.
* Default PresentationModelFactory implementation that uses a {@link IdentityHashMap} to map domain models to PresentationModels.
* @author Keith Donald
* @since 3.0
*/
public class DefaultPresentationModelFactory implements PresentationModelFactory {