Codota Logo
AbstractPropertyBindingResult.getPropertyAccessor
Code IndexAdd Codota to your IDE (free)

How to use
getPropertyAccessor
method
in
org.springframework.validation.AbstractPropertyBindingResult

Best Java code snippets using org.springframework.validation.AbstractPropertyBindingResult.getPropertyAccessor (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-framework

/**
 * Returns the underlying PropertyAccessor.
 * @see #getPropertyAccessor()
 */
@Override
public PropertyEditorRegistry getPropertyEditorRegistry() {
  return (getTarget() != null ? getPropertyAccessor() : null);
}
origin: spring-projects/spring-framework

/**
 * Return the underlying PropertyAccessor of this binder's BindingResult.
 */
protected ConfigurablePropertyAccessor getPropertyAccessor() {
  return getInternalBindingResult().getPropertyAccessor();
}
origin: spring-projects/spring-framework

/**
 * Fetches the field value from the PropertyAccessor.
 * @see #getPropertyAccessor()
 */
@Override
@Nullable
protected Object getActualFieldValue(String field) {
  return getPropertyAccessor().getPropertyValue(field);
}
origin: spring-projects/spring-framework

/**
 * Retrieve the custom PropertyEditor for the given field, if any.
 * @param fixedField the fully qualified field name
 * @return the custom PropertyEditor, or {@code null}
 */
@Nullable
protected PropertyEditor getCustomEditor(String fixedField) {
  Class<?> targetType = getPropertyAccessor().getPropertyType(fixedField);
  PropertyEditor editor = getPropertyAccessor().findCustomEditor(targetType, fixedField);
  if (editor == null) {
    editor = BeanUtils.findEditorByConvention(targetType);
  }
  return editor;
}
origin: spring-projects/spring-framework

public void initConversion(ConversionService conversionService) {
  Assert.notNull(conversionService, "ConversionService must not be null");
  this.conversionService = conversionService;
  if (getTarget() != null) {
    getPropertyAccessor().setConversionService(conversionService);
  }
}
origin: org.springframework/spring-context

/**
 * Fetches the field value from the PropertyAccessor.
 * @see #getPropertyAccessor()
 */
@Override
@Nullable
protected Object getActualFieldValue(String field) {
  return getPropertyAccessor().getPropertyValue(field);
}
origin: org.springframework/spring-context

/**
 * Return the underlying PropertyAccessor of this binder's BindingResult.
 */
protected ConfigurablePropertyAccessor getPropertyAccessor() {
  return getInternalBindingResult().getPropertyAccessor();
}
origin: org.springframework/spring-context

/**
 * Returns the underlying PropertyAccessor.
 * @see #getPropertyAccessor()
 */
@Override
public PropertyEditorRegistry getPropertyEditorRegistry() {
  return (getTarget() != null ? getPropertyAccessor() : null);
}
origin: spring-projects/spring-framework

/**
 * Determines the field type from the property type.
 * @see #getPropertyAccessor()
 */
@Override
@Nullable
public Class<?> getFieldType(@Nullable String field) {
  return (getTarget() != null ? getPropertyAccessor().getPropertyType(fixedField(field)) :
      super.getFieldType(field));
}
origin: org.springframework/spring-context

public void initConversion(ConversionService conversionService) {
  Assert.notNull(conversionService, "ConversionService must not be null");
  this.conversionService = conversionService;
  if (getTarget() != null) {
    getPropertyAccessor().setConversionService(conversionService);
  }
}
origin: org.springframework/spring-context

/**
 * Retrieve the custom PropertyEditor for the given field, if any.
 * @param fixedField the fully qualified field name
 * @return the custom PropertyEditor, or {@code null}
 */
@Nullable
protected PropertyEditor getCustomEditor(String fixedField) {
  Class<?> targetType = getPropertyAccessor().getPropertyType(fixedField);
  PropertyEditor editor = getPropertyAccessor().findCustomEditor(targetType, fixedField);
  if (editor == null) {
    editor = BeanUtils.findEditorByConvention(targetType);
  }
  return editor;
}
origin: spring-projects/spring-framework

/**
 * Return the underlying TypeConverter of this binder's BindingResult.
 */
protected PropertyEditorRegistry getPropertyEditorRegistry() {
  if (getTarget() != null) {
    return getInternalBindingResult().getPropertyAccessor();
  }
  else {
    return getSimpleTypeConverter();
  }
}
origin: spring-projects/spring-framework

/**
 * Return the underlying TypeConverter of this binder's BindingResult.
 */
protected TypeConverter getTypeConverter() {
  if (getTarget() != null) {
    return getInternalBindingResult().getPropertyAccessor();
  }
  else {
    return getSimpleTypeConverter();
  }
}
origin: org.springframework/spring-context

/**
 * Determines the field type from the property type.
 * @see #getPropertyAccessor()
 */
@Override
@Nullable
public Class<?> getFieldType(@Nullable String field) {
  return (getTarget() != null ? getPropertyAccessor().getPropertyType(fixedField(field)) :
      super.getFieldType(field));
}
origin: org.springframework/spring-context

/**
 * Return the underlying TypeConverter of this binder's BindingResult.
 */
protected TypeConverter getTypeConverter() {
  if (getTarget() != null) {
    return getInternalBindingResult().getPropertyAccessor();
  }
  else {
    return getSimpleTypeConverter();
  }
}
origin: org.springframework/spring-context

/**
 * Return the underlying TypeConverter of this binder's BindingResult.
 */
protected PropertyEditorRegistry getPropertyEditorRegistry() {
  if (getTarget() != null) {
    return getInternalBindingResult().getPropertyAccessor();
  }
  else {
    return getSimpleTypeConverter();
  }
}
origin: spring-projects/spring-framework

/**
 * This implementation exposes a PropertyEditor adapter for a Formatter,
 * if applicable.
 */
@Override
@Nullable
public PropertyEditor findEditor(@Nullable String field, @Nullable Class<?> valueType) {
  Class<?> valueTypeForLookup = valueType;
  if (valueTypeForLookup == null) {
    valueTypeForLookup = getFieldType(field);
  }
  PropertyEditor editor = super.findEditor(field, valueTypeForLookup);
  if (editor == null && this.conversionService != null) {
    TypeDescriptor td = null;
    if (field != null && getTarget() != null) {
      TypeDescriptor ptd = getPropertyAccessor().getPropertyTypeDescriptor(fixedField(field));
      if (ptd != null && (valueType == null || valueType.isAssignableFrom(ptd.getType()))) {
        td = ptd;
      }
    }
    if (td == null) {
      td = TypeDescriptor.valueOf(valueTypeForLookup);
    }
    if (this.conversionService.canConvert(TypeDescriptor.valueOf(String.class), td)) {
      editor = new ConvertingPropertyEditorAdapter(this.conversionService, td);
    }
  }
  return editor;
}
origin: spring-projects/spring-framework

/**
 * Formats the field value based on registered PropertyEditors.
 * @see #getCustomEditor
 */
@Override
protected Object formatFieldValue(String field, @Nullable Object value) {
  String fixedField = fixedField(field);
  // Try custom editor...
  PropertyEditor customEditor = getCustomEditor(fixedField);
  if (customEditor != null) {
    customEditor.setValue(value);
    String textValue = customEditor.getAsText();
    // If the PropertyEditor returned null, there is no appropriate
    // text representation for this value: only use it if non-null.
    if (textValue != null) {
      return textValue;
    }
  }
  if (this.conversionService != null) {
    // Try custom converter...
    TypeDescriptor fieldDesc = getPropertyAccessor().getPropertyTypeDescriptor(fixedField);
    TypeDescriptor strDesc = TypeDescriptor.valueOf(String.class);
    if (fieldDesc != null && this.conversionService.canConvert(fieldDesc, strDesc)) {
      return this.conversionService.convert(value, fieldDesc, strDesc);
    }
  }
  return value;
}
origin: org.springframework/spring-context

/**
 * Formats the field value based on registered PropertyEditors.
 * @see #getCustomEditor
 */
@Override
protected Object formatFieldValue(String field, @Nullable Object value) {
  String fixedField = fixedField(field);
  // Try custom editor...
  PropertyEditor customEditor = getCustomEditor(fixedField);
  if (customEditor != null) {
    customEditor.setValue(value);
    String textValue = customEditor.getAsText();
    // If the PropertyEditor returned null, there is no appropriate
    // text representation for this value: only use it if non-null.
    if (textValue != null) {
      return textValue;
    }
  }
  if (this.conversionService != null) {
    // Try custom converter...
    TypeDescriptor fieldDesc = getPropertyAccessor().getPropertyTypeDescriptor(fixedField);
    TypeDescriptor strDesc = TypeDescriptor.valueOf(String.class);
    if (fieldDesc != null && this.conversionService.canConvert(fieldDesc, strDesc)) {
      return this.conversionService.convert(value, fieldDesc, strDesc);
    }
  }
  return value;
}
origin: spring-projects/spring-framework

@Test // SPR-15009
public void testSetCustomMessageCodesResolverBeforeInitializeBindingResultForBeanPropertyAccess() {
  TestBean testBean = new TestBean();
  DataBinder binder = new DataBinder(testBean, "testBean");
  DefaultMessageCodesResolver messageCodesResolver = new DefaultMessageCodesResolver();
  messageCodesResolver.setPrefix("errors.");
  binder.setMessageCodesResolver(messageCodesResolver);
  binder.setAutoGrowCollectionLimit(512); // allow configuration after set a MessageCodesResolver
  binder.initBeanPropertyAccess();
  MutablePropertyValues mpv = new MutablePropertyValues();
  mpv.add("age", "invalid");
  binder.bind(mpv);
  assertEquals("errors.typeMismatch", binder.getBindingResult().getFieldError("age").getCode());
  assertEquals(512, BeanWrapper.class.cast(binder.getInternalBindingResult().getPropertyAccessor()).getAutoGrowCollectionLimit());
}
org.springframework.validationAbstractPropertyBindingResultgetPropertyAccessor

Javadoc

Provide the PropertyAccessor to work with, according to the concrete strategy of access.

Note that a PropertyAccessor used by a BindingResult should always have its "extractOldValueForEditor" flag set to "true" by default, since this is typically possible without side effects for model objects that serve as data binding target.

Popular methods of AbstractPropertyBindingResult

  • fixedField
  • getCustomEditor
    Retrieve the custom PropertyEditor for the given field, if any.
  • getFieldType
    Determines the field type from the property type.
  • getTarget
  • initConversion
  • setMessageCodesResolver
  • getPropertyEditorRegistry
    Returns the underlying PropertyAccessor.

Popular in Java

  • Start an intent from android
  • notifyDataSetChanged (ArrayAdapter)
  • getApplicationContext (Context)
  • addToBackStack (FragmentTransaction)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • DataSource (javax.sql)
    A factory for connections to the physical data source that this DataSource object represents. An alt
  • JButton (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now