polish
This commit is contained in:
parent
a6cd69dc7c
commit
bbe4c2b611
|
|
@ -18,6 +18,11 @@ package org.springframework.ui.binding.support;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.ObjectUtils;
|
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 {
|
public class CollectionTypeDescriptor {
|
||||||
|
|
||||||
private Class<?> type;
|
private Class<?> type;
|
||||||
|
|
@ -38,7 +43,7 @@ public class CollectionTypeDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The element type.
|
* The parameterized collection element type.
|
||||||
*/
|
*/
|
||||||
public Class<?> getElementType() {
|
public Class<?> getElementType() {
|
||||||
return elementType;
|
return elementType;
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,11 @@ import org.springframework.ui.format.Formatter;
|
||||||
import org.springframework.ui.message.MessageBuilder;
|
import org.springframework.ui.message.MessageBuilder;
|
||||||
import org.springframework.ui.message.ResolvableArgument;
|
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 {
|
public class DefaultFieldModel implements FieldModel {
|
||||||
|
|
||||||
private ValueModel valueModel;
|
private ValueModel valueModel;
|
||||||
|
|
|
||||||
|
|
@ -32,20 +32,19 @@ import org.springframework.core.convert.support.DefaultTypeConverter;
|
||||||
import org.springframework.ui.binding.FieldModel;
|
import org.springframework.ui.binding.FieldModel;
|
||||||
import org.springframework.ui.binding.FieldNotFoundException;
|
import org.springframework.ui.binding.FieldNotFoundException;
|
||||||
import org.springframework.ui.binding.PresentationModel;
|
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.Condition;
|
||||||
|
import org.springframework.ui.binding.config.FieldModelConfiguration;
|
||||||
import org.springframework.ui.format.Formatter;
|
import org.springframework.ui.format.Formatter;
|
||||||
import org.springframework.util.Assert;
|
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
|
* @author Keith Donald
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
* @see #setFormatterRegistry(FormatterRegistry)
|
* @see #setFormatterRegistry(FormatterRegistry)
|
||||||
* @see #setMessageSource(MessageSource)
|
* @see #setMessageSource(MessageSource)
|
||||||
* @see #setTypeConverter(TypeConverter)
|
* @see #setTypeConverter(TypeConverter)
|
||||||
* @see #bind(Map)
|
* @see #field(String)
|
||||||
*/
|
*/
|
||||||
public class DefaultPresentationModel implements PresentationModel {
|
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.
|
* Add a FieldModel rule at the domain object property path.
|
||||||
* @param propertyPath binding rule property path in format prop.nestedProp
|
* @param propertyPath the domain object property path in format <prop>[.nestedProp]
|
||||||
* @return a builder for the binding rule
|
* @return a builder for the field model configuration
|
||||||
*/
|
*/
|
||||||
public FieldModelConfiguration field(String propertyPath) {
|
public FieldModelConfiguration field(String propertyPath) {
|
||||||
FieldPath path = new FieldPath(propertyPath);
|
FieldPath path = new FieldPath(propertyPath);
|
||||||
|
|
@ -116,6 +115,9 @@ public class DefaultPresentationModel implements PresentationModel {
|
||||||
return rule;
|
return rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The domain-layer model this presentation model coordinates with.
|
||||||
|
*/
|
||||||
public Object getDomainModel() {
|
public Object getDomainModel() {
|
||||||
return domainModel;
|
return domainModel;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,9 @@ import org.springframework.ui.binding.PresentationModel;
|
||||||
import org.springframework.ui.binding.PresentationModelFactory;
|
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
|
* @author Keith Donald
|
||||||
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class DefaultPresentationModelFactory implements PresentationModelFactory {
|
public class DefaultPresentationModelFactory implements PresentationModelFactory {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue