Tabnine Logo
PropertyMatches.forField
Code IndexAdd Tabnine to your IDE (free)

How to use
forField
method
in
org.springframework.beans.PropertyMatches

Best Java code snippets using org.springframework.beans.PropertyMatches.forField (Showing top 14 results out of 315)

origin: spring-projects/spring-framework

/**
 * Create PropertyMatches for the given field property.
 * @param propertyName the name of the field to find possible matches for
 * @param beanClass the bean class to search for matches
 */
public static PropertyMatches forField(String propertyName, Class<?> beanClass) {
  return forField(propertyName, beanClass, DEFAULT_MAX_DISTANCE);
}
origin: org.springframework/spring-beans

/**
 * Create PropertyMatches for the given field property.
 * @param propertyName the name of the field to find possible matches for
 * @param beanClass the bean class to search for matches
 */
public static PropertyMatches forField(String propertyName, Class<?> beanClass) {
  return forField(propertyName, beanClass, DEFAULT_MAX_DISTANCE);
}
origin: spring-projects/spring-framework

@Test
public void simpleFieldPropertyErrorMessage() {
  PropertyMatches matches = PropertyMatches.forField("naem", SampleFieldProperties.class);
  String msg = matches.buildErrorMessage();
  assertThat(msg, containsString("naem"));
  assertThat(msg, containsString("name"));
  assertThat(msg, containsString("field"));
  assertThat(msg, not(containsString("setter")));
}
origin: spring-projects/spring-framework

@Override
protected NotWritablePropertyException createNotWritablePropertyException(String propertyName) {
  PropertyMatches matches = PropertyMatches.forField(propertyName, getRootClass());
  throw new NotWritablePropertyException(
      getRootClass(), getNestedPath() + propertyName,
      matches.buildErrorMessage(), matches.getPossibleMatches());
}
origin: spring-projects/spring-framework

@Test
public void complexFieldPropertyErrorMessage() {
  PropertyMatches matches = PropertyMatches.forField("counter", SampleFieldProperties.class);
  String msg = matches.buildErrorMessage();
  assertThat(msg, containsString("counter"));
  assertThat(msg, containsString("counter1"));
  assertThat(msg, containsString("counter2"));
  assertThat(msg, containsString("counter3"));
}
origin: spring-projects/spring-framework

@Test
public void complexFieldPropertyTypo() {
  PropertyMatches matches = PropertyMatches.forField("desriptn", SampleFieldProperties.class);
  assertThat(matches.getPossibleMatches(), emptyArray());
}
origin: spring-projects/spring-framework

@Test
public void simpleFieldPropertyTypo() {
  PropertyMatches matches = PropertyMatches.forField("naem", SampleFieldProperties.class);
  assertThat(matches.getPossibleMatches(), hasItemInArray("name"));
}
origin: spring-projects/spring-framework

@Test
public void unknownFieldProperty() {
  PropertyMatches matches = PropertyMatches.forField("unknown", SampleFieldProperties.class);
  assertThat(matches.getPossibleMatches(), emptyArray());
}
origin: org.springframework/spring-beans

@Override
protected NotWritablePropertyException createNotWritablePropertyException(String propertyName) {
  PropertyMatches matches = PropertyMatches.forField(propertyName, getRootClass());
  throw new NotWritablePropertyException(
      getRootClass(), getNestedPath() + propertyName,
      matches.buildErrorMessage(), matches.getPossibleMatches());
}
origin: spring-projects/spring-framework

@Test
public void severalMatchesFieldProperty() {
  PropertyMatches matches = PropertyMatches.forField("counter", SampleFieldProperties.class);
  assertThat(matches.getPossibleMatches(), hasItemInArray("counter1"));
  assertThat(matches.getPossibleMatches(), hasItemInArray("counter2"));
  assertThat(matches.getPossibleMatches(), hasItemInArray("counter3"));
}
origin: apache/servicemix-bundles

/**
 * Create PropertyMatches for the given field property.
 * @param propertyName the name of the field to find possible matches for
 * @param beanClass the bean class to search for matches
 */
public static PropertyMatches forField(String propertyName, Class<?> beanClass) {
  return forField(propertyName, beanClass, DEFAULT_MAX_DISTANCE);
}
origin: apache/servicemix-bundles

  private static Set<String> detectPotentialMatches(String propertyName, Class<?> type) {

    Set<String> result = new HashSet<>();
    result.addAll(Arrays.asList(PropertyMatches.forField(propertyName, type).getPossibleMatches()));
    result.addAll(Arrays.asList(PropertyMatches.forProperty(propertyName, type).getPossibleMatches()));

    return result;
  }
}
origin: apache/servicemix-bundles

  /**
   * Detects all potential matches for the given property name and type.
   *
   * @param propertyName must not be {@literal null} or empty.
   * @param type must not be {@literal null}.
   * @return
   */
  private static Set<String> detectPotentialMatches(String propertyName, Class<?> type) {

    Set<String> result = new HashSet<>();
    result.addAll(Arrays.asList(PropertyMatches.forField(propertyName, type).getPossibleMatches()));
    result.addAll(Arrays.asList(PropertyMatches.forProperty(propertyName, type).getPossibleMatches()));

    return result;
  }
}
origin: apache/servicemix-bundles

@Override
protected NotWritablePropertyException createNotWritablePropertyException(String propertyName) {
  PropertyMatches matches = PropertyMatches.forField(propertyName, getRootClass());
  throw new NotWritablePropertyException(
      getRootClass(), getNestedPath() + propertyName,
      matches.buildErrorMessage(), matches.getPossibleMatches());
}
org.springframework.beansPropertyMatchesforField

Javadoc

Create PropertyMatches for the given field property.

Popular methods of PropertyMatches

  • forProperty
    Create PropertyMatches for the given bean property.
  • getPossibleMatches
    Return the calculated possible matches.
  • buildErrorMessage
    Build an error message for the given invalid property name, indicating the possible property matches
  • <init>
    Create a new PropertyMatches instance for the given property and possible matches.
  • calculateMatches
    Generate possible property alternatives for the given property and class. Internally uses the getStr
  • calculateStringDistance
    Calculate the distance between the given two Strings according to the Levenshtein algorithm.

Popular in Java

  • Updating database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • setRequestProperty (URLConnection)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Table (org.hibernate.mapping)
    A relational table
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now