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

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

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

origin: spring-projects/spring-framework

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

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

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

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

@Test
public void complexBeanPropertyErrorMessage() {
  PropertyMatches matches = PropertyMatches.forProperty("counter", SampleBeanProperties.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 simpleBeanPropertyTypo() {
  PropertyMatches matches = PropertyMatches.forProperty("naem", SampleBeanProperties.class);
  assertThat(matches.getPossibleMatches(), hasItemInArray("name"));
}
origin: spring-projects/spring-framework

@Test
public void unknownBeanProperty() {
  PropertyMatches matches = PropertyMatches.forProperty("unknown", SampleBeanProperties.class);
  assertThat(matches.getPossibleMatches(), emptyArray());
}
origin: spring-projects/spring-framework

@Test
public void complexBeanPropertyTypo() {
  PropertyMatches matches = PropertyMatches.forProperty("desriptn", SampleBeanProperties.class);
  assertThat(matches.getPossibleMatches(), emptyArray());
}
origin: org.springframework/spring-beans

@Override
protected NotWritablePropertyException createNotWritablePropertyException(String propertyName) {
  PropertyMatches matches = PropertyMatches.forProperty(propertyName, getRootClass());
  throw new NotWritablePropertyException(getRootClass(), getNestedPath() + propertyName,
      matches.buildErrorMessage(), matches.getPossibleMatches());
}
origin: camunda/camunda-bpm-platform

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

@Test
public void severalMatchesBeanProperty() {
  PropertyMatches matches = PropertyMatches.forProperty("counter", SampleBeanProperties.class);
  assertThat(matches.getPossibleMatches(), hasItemInArray("counter1"));
  assertThat(matches.getPossibleMatches(), hasItemInArray("counter2"));
  assertThat(matches.getPossibleMatches(), hasItemInArray("counter3"));
}
origin: camunda/camunda-bpm-platform

PropertyMatches matches = PropertyMatches.forProperty(propertyName, getRootClass());
throw new NotWritablePropertyException(
    getRootClass(), this.nestedPath + propertyName,
origin: apache/servicemix-bundles

/**
 * Create PropertyMatches for the given bean property.
 * @param propertyName the name of the property to find possible matches for
 * @param beanClass the bean class to search for matches
 */
public static PropertyMatches forProperty(String propertyName, Class<?> beanClass) {
  return forProperty(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.forProperty(propertyName, getRootClass());
  throw new NotWritablePropertyException(getRootClass(), getNestedPath() + propertyName,
      matches.buildErrorMessage(), matches.getPossibleMatches());
}
org.springframework.beansPropertyMatchesforProperty

Javadoc

Create PropertyMatches for the given bean property.

Popular methods of PropertyMatches

  • getPossibleMatches
    Return the calculated possible matches.
  • buildErrorMessage
    Build an error message for the given invalid property name, indicating the possible property matches
  • forField
    Create PropertyMatches for the given field property.
  • <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

  • Reactive rest calls using spring rest template
  • getContentResolver (Context)
  • startActivity (Activity)
  • compareTo (BigDecimal)
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • CodeWhisperer alternatives
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