Example usage for org.springframework.beans PropertyAccessorUtils canonicalPropertyNames

List of usage examples for org.springframework.beans PropertyAccessorUtils canonicalPropertyNames

Introduction

In this page you can find the example usage for org.springframework.beans PropertyAccessorUtils canonicalPropertyNames.

Prototype

@Nullable
public static String[] canonicalPropertyNames(@Nullable String[] propertyNames) 

Source Link

Document

Determine the canonical names for the given property paths.

Usage

From source file:org.agatom.springatom.cmp.wizards.core.WizardDataBinder.java

@Override
public void setAllowedFields(final String... allowedFields) {
    final String[] oldFields = this.getAllowedFields();
    String[] newFields = PropertyAccessorUtils.canonicalPropertyNames(allowedFields);
    if (this.areFieldsSet(oldFields)) {
        // update
        newFields = ArrayUtils.addAll(oldFields, newFields);
    }/*  w  ww. j  av a  2  s  . c  o  m*/
    super.setAllowedFields(newFields);
}

From source file:org.agatom.springatom.cmp.wizards.core.WizardDataBinder.java

@Override
public void setRequiredFields(final String... requiredFields) {
    final String[] oldFields = this.getRequiredFields();
    String[] newFields = PropertyAccessorUtils.canonicalPropertyNames(requiredFields);
    if (this.areFieldsSet(oldFields)) {
        // update
        newFields = ArrayUtils.addAll(oldFields, newFields);
    }// w  w  w . j av  a2s .  com
    super.setRequiredFields(newFields);
}

From source file:org.springframework.validation.DataBinder.java

/**
 * Register fields that should be allowed for binding. Default is all
 * fields. Restrict this for example to avoid unwanted modifications
 * by malicious users when binding HTTP request parameters.
 * <p>Supports "xxx*", "*xxx" and "*xxx*" patterns. More sophisticated matching
 * can be implemented by overriding the {@code isAllowed} method.
 * <p>Alternatively, specify a list of <i>disallowed</i> fields.
 * @param allowedFields array of field names
 * @see #setDisallowedFields//from   w  w w  . j  a  v a 2 s  .  c o  m
 * @see #isAllowed(String)
 */
public void setAllowedFields(@Nullable String... allowedFields) {
    this.allowedFields = PropertyAccessorUtils.canonicalPropertyNames(allowedFields);
}

From source file:org.springframework.validation.DataBinder.java

/**
 * Register fields that should <i>not</i> be allowed for binding. Default is none.
 * Mark fields as disallowed for example to avoid unwanted modifications
 * by malicious users when binding HTTP request parameters.
 * <p>Supports "xxx*", "*xxx" and "*xxx*" patterns. More sophisticated matching
 * can be implemented by overriding the {@code isAllowed} method.
 * <p>Alternatively, specify a list of <i>allowed</i> fields.
 * @param disallowedFields array of field names
 * @see #setAllowedFields/*from w ww  .j  av a 2 s. c o m*/
 * @see #isAllowed(String)
 */
public void setDisallowedFields(@Nullable String... disallowedFields) {
    this.disallowedFields = PropertyAccessorUtils.canonicalPropertyNames(disallowedFields);
}

From source file:org.springframework.validation.DataBinder.java

/**
 * Register fields that are required for each binding process.
 * <p>If one of the specified fields is not contained in the list of
 * incoming property values, a corresponding "missing field" error
 * will be created, with error code "required" (by the default
 * binding error processor).// w  w w  .jav a  2s  . co  m
 * @param requiredFields array of field names
 * @see #setBindingErrorProcessor
 * @see DefaultBindingErrorProcessor#MISSING_FIELD_ERROR_CODE
 */
public void setRequiredFields(@Nullable String... requiredFields) {
    this.requiredFields = PropertyAccessorUtils.canonicalPropertyNames(requiredFields);
    if (logger.isDebugEnabled()) {
        logger.debug("DataBinder requires binding of required fields ["
                + StringUtils.arrayToCommaDelimitedString(requiredFields) + "]");
    }
}