congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.springframework.beans
Code IndexAdd Tabnine to your IDE (free)

How to use org.springframework.beans

Best Java code snippets using org.springframework.beans (Showing top 20 results out of 58,662)

origin: spring-projects/spring-framework

@Override
public PropertyDescriptor getPropertyDescriptor(String propertyName) throws InvalidPropertyException {
  BeanWrapperImpl nestedBw = (BeanWrapperImpl) getPropertyAccessorForPropertyPath(propertyName);
  String finalPath = getFinalPath(nestedBw, propertyName);
  PropertyDescriptor pd = nestedBw.getCachedIntrospectionResults().getPropertyDescriptor(finalPath);
  if (pd == null) {
    throw new InvalidPropertyException(getRootClass(), getNestedPath() + propertyName,
        "No property '" + propertyName + "' found");
  }
  return pd;
}
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

@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

/**
 * Overloaded version of {@code addPropertyValue} that takes
 * a property name and a property value.
 * <p>Note: As of Spring 3.0, we recommend using the more concise
 * and chaining-capable variant {@link #add}.
 * @param propertyName name of the property
 * @param propertyValue value of the property
 * @see #addPropertyValue(PropertyValue)
 */
public void addPropertyValue(String propertyName, Object propertyValue) {
  addPropertyValue(new PropertyValue(propertyName, propertyValue));
}
origin: spring-projects/spring-framework

@Override
public void setPropertyValue(PropertyValue pv) throws BeansException {
  setPropertyValue(pv.getName(), pv.getValue());
}
origin: spring-projects/spring-framework

/**
 * Create a new accessor, wrapping a new instance of the specified class.
 * @param clazz class to instantiate and wrap
 */
protected AbstractNestablePropertyAccessor(Class<?> clazz) {
  registerDefaultEditors();
  setWrappedInstance(BeanUtils.instantiateClass(clazz));
}
origin: spring-projects/spring-framework

@Override
public void setPropertyValues(Map<?, ?> map) throws BeansException {
  setPropertyValues(new MutablePropertyValues(map));
}
origin: spring-projects/spring-framework

/**
 * Return property values for this bean (never {@code null}).
 */
@Override
public MutablePropertyValues getPropertyValues() {
  if (this.propertyValues == null) {
    this.propertyValues = new MutablePropertyValues();
  }
  return this.propertyValues;
}
origin: spring-projects/spring-framework

@Test
public void notWritablePropertyExceptionContainsAlternativeMatch() {
  IntelliBean target = new IntelliBean();
  BeanWrapper bw = createAccessor(target);
  try {
    bw.setPropertyValue("names", "Alef");
  }
  catch (NotWritablePropertyException ex) {
    assertNotNull("Possible matches not determined", ex.getPossibleMatches());
    assertEquals("Invalid amount of alternatives", 1, ex.getPossibleMatches().length);
  }
}
origin: spring-projects/spring-framework

public BeanPropertyMatches(String propertyName, Class<?> beanClass, int maxDistance) {
  super(propertyName,
      calculateMatches(propertyName, BeanUtils.getPropertyDescriptors(beanClass), maxDistance));
}
origin: spring-projects/spring-framework

private PropertyValue createDefaultPropertyValue(PropertyTokenHolder tokens) {
  TypeDescriptor desc = getPropertyTypeDescriptor(tokens.canonicalName);
  if (desc == null) {
    throw new NullValueInNestedPathException(getRootClass(), this.nestedPath + tokens.canonicalName,
        "Could not determine property type for auto-growing a default value");
  }
  Object defaultValue = newValue(desc.getType(), desc, tokens.canonicalName);
  return new PropertyValue(tokens.canonicalName, defaultValue);
}
origin: spring-projects/spring-framework

/**
 * Override default editor, if possible (since that's what we really mean to do here);
 * otherwise register as a custom editor.
 */
private void doRegisterEditor(PropertyEditorRegistry registry, Class<?> requiredType, PropertyEditor editor) {
  if (registry instanceof PropertyEditorRegistrySupport) {
    ((PropertyEditorRegistrySupport) registry).overrideDefaultEditor(requiredType, editor);
  }
  else {
    registry.registerCustomEditor(requiredType, editor);
  }
}
origin: spring-projects/spring-framework

/**
 * Obtain a lazily initialized CachedIntrospectionResults instance
 * for the wrapped object.
 */
private CachedIntrospectionResults getCachedIntrospectionResults() {
  if (this.cachedIntrospectionResults == null) {
    this.cachedIntrospectionResults = CachedIntrospectionResults.forClass(getWrappedClass());
  }
  return this.cachedIntrospectionResults;
}
origin: spring-projects/spring-framework

@Override
@Nullable
protected BeanPropertyHandler getLocalPropertyHandler(String propertyName) {
  PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(propertyName);
  return (pd != null ? new BeanPropertyHandler(pd) : null);
}
origin: spring-projects/spring-framework

/**
 * Returns the canonical property name.
 * @see org.springframework.beans.PropertyAccessorUtils#canonicalPropertyName
 */
@Override
protected String canonicalFieldName(String field) {
  return PropertyAccessorUtils.canonicalPropertyName(field);
}
origin: spring-projects/spring-framework

@Override
public PropertyDescriptor[] getPropertyDescriptors() {
  return getCachedIntrospectionResults().getPropertyDescriptors();
}
origin: spring-projects/spring-framework

public SimpleTypeConverter() {
  this.typeConverterDelegate = new TypeConverterDelegate(this);
  registerDefaultEditors();
}
origin: spring-projects/spring-framework

/**
 * Create a new empty accessor. Wrapped instance needs to be set afterwards.
 * @param registerDefaultEditors whether to register default editors
 * (can be suppressed if the accessor won't need any type conversion)
 * @see #setWrappedInstance
 */
protected AbstractNestablePropertyAccessor(boolean registerDefaultEditors) {
  if (registerDefaultEditors) {
    registerDefaultEditors();
  }
  this.typeConverterDelegate = new TypeConverterDelegate(this);
}
origin: spring-projects/spring-framework

private Person createPerson(String name, String city, String country) {
  return new Person(name, new Address(city, country));
}
origin: spring-projects/spring-framework

@Test
public void notWritablePropertyExceptionContainsAlternativeMatches() {
  IntelliBean target = new IntelliBean();
  BeanWrapper bw = createAccessor(target);
  try {
    bw.setPropertyValue("mystring", "Arjen");
  }
  catch (NotWritablePropertyException ex) {
    assertNotNull("Possible matches not determined", ex.getPossibleMatches());
    assertEquals("Invalid amount of alternatives", 3, ex.getPossibleMatches().length);
  }
}
org.springframework.beans

Most used classes

  • Autowired
  • Value
  • Qualifier
  • BeanDefinitionBuilder
    Programmatic means of constructing org.springframework.beans.factory.config.BeanDefinitionusing the
  • ConfigurableListableBeanFactory
    Configuration interface to be implemented by most listable bean factories. In addition to Configurab
  • BeanDefinition,
  • BeanDefinitionRegistry,
  • BeanFactory,
  • ParserContext,
  • MutablePropertyValues,
  • AutowireCapableBeanFactory,
  • DefaultListableBeanFactory,
  • BeanCreationException,
  • RuntimeBeanReference,
  • RootBeanDefinition,
  • AbstractBeanDefinition,
  • XmlReaderContext,
  • Required,
  • BeanWrapper
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