Tabnine Logo
Property
Code IndexAdd Tabnine to your IDE (free)

How to use
Property
in
org.springframework.core.convert

Best Java code snippets using org.springframework.core.convert.Property (Showing top 20 results out of 315)

origin: spring-projects/spring-framework

@Override
public boolean canWrite(EvaluationContext context, @Nullable Object target, String name) throws AccessException {
  if (!this.allowWrite || target == null) {
    return false;
  }
  Class<?> type = (target instanceof Class ? (Class<?>) target : target.getClass());
  PropertyCacheKey cacheKey = new PropertyCacheKey(type, name, target instanceof Class);
  if (this.writerCache.containsKey(cacheKey)) {
    return true;
  }
  Method method = findSetterForProperty(name, type, target);
  if (method != null) {
    // Treat it like a property
    Property property = new Property(type, null, method);
    TypeDescriptor typeDescriptor = new TypeDescriptor(property);
    this.writerCache.put(cacheKey, method);
    this.typeDescriptorCache.put(cacheKey, typeDescriptor);
    return true;
  }
  else {
    Field field = findField(name, type, target);
    if (field != null) {
      this.writerCache.put(cacheKey, field);
      this.typeDescriptorCache.put(cacheKey, new TypeDescriptor(field));
      return true;
    }
  }
  return false;
}
origin: spring-projects/spring-framework

@Nullable
private Field getField() {
  String name = getName();
  if (!StringUtils.hasLength(name)) {
    return null;
  }
  Field field = null;
  Class<?> declaringClass = declaringClass();
  if (declaringClass != null) {
    field = ReflectionUtils.findField(declaringClass, name);
    if (field == null) {
      // Same lenient fallback checking as in CachedIntrospectionResults...
      field = ReflectionUtils.findField(declaringClass, StringUtils.uncapitalize(name));
      if (field == null) {
        field = ReflectionUtils.findField(declaringClass, StringUtils.capitalize(name));
      }
    }
  }
  return field;
}
origin: spring-projects/spring-framework

private MethodParameter resolveParameterType(MethodParameter parameter) {
  // needed to resolve generic property types that parameterized by sub-classes e.g. T getFoo();
  GenericTypeResolver.resolveParameterType(parameter, getObjectType());
  return parameter;
}
origin: spring-projects/spring-framework

private Annotation[] resolveAnnotations() {
  Annotation[] annotations = annotationCache.get(this);
  if (annotations == null) {
    Map<Class<? extends Annotation>, Annotation> annotationMap = new LinkedHashMap<>();
    addAnnotationsToMap(annotationMap, getReadMethod());
    addAnnotationsToMap(annotationMap, getWriteMethod());
    addAnnotationsToMap(annotationMap, getField());
    annotations = annotationMap.values().toArray(new Annotation[0]);
    annotationCache.put(this, annotations);
  }
  return annotations;
}
origin: spring-projects/spring-framework

@Nullable
private Class<?> declaringClass() {
  if (getReadMethod() != null) {
    return getReadMethod().getDeclaringClass();
  }
  else if (getWriteMethod() != null) {
    return getWriteMethod().getDeclaringClass();
  }
  else {
    return null;
  }
}
origin: spring-projects/spring-framework

@Nullable
private MethodParameter resolveWriteMethodParameter() {
  if (getWriteMethod() == null) {
    return null;
  }
  return resolveParameterType(new MethodParameter(getWriteMethod(), 0));
}
origin: spring-projects/spring-framework

/**
 * Create a new type descriptor from a {@link Property}.
 * <p>Use this constructor when a source or target conversion point is a
 * property on a Java class.
 * @param property the property
 */
public TypeDescriptor(Property property) {
  Assert.notNull(property, "Property must not be null");
  this.resolvableType = ResolvableType.forMethodParameter(property.getMethodParameter());
  this.type = this.resolvableType.resolve(property.getType());
  this.annotatedElement = new AnnotatedElementAdapter(property.getAnnotations());
}
origin: camunda/camunda-bpm-platform

private Annotation[] resolveAnnotations() {
  Map<Class<?>, Annotation> annMap = new LinkedHashMap<Class<?>, Annotation>();
  Method readMethod = getReadMethod();
  if (readMethod != null) {
    for (Annotation ann : readMethod.getAnnotations()) {
      annMap.put(ann.annotationType(), ann);
    }
  }
  Method writeMethod = getWriteMethod();
  if (writeMethod != null) {
    for (Annotation ann : writeMethod.getAnnotations()) {
      annMap.put(ann.annotationType(), ann);
    }
  }
  Field field = getField();
  if (field != null) {
    for (Annotation ann : field.getAnnotations()) {
      annMap.put(ann.annotationType(), ann);
    }
  }
  return annMap.values().toArray(new Annotation[annMap.size()]);
}
origin: spring-projects/spring-framework

@Nullable
private MethodParameter resolveReadMethodParameter() {
  if (getReadMethod() == null) {
    return null;
  }
  return resolveParameterType(new MethodParameter(getReadMethod(), -1));
}
origin: philwebb/springfaces

public boolean isRequired(UIComponent component) {
  ELContext elContext = DefaultComponentInfo.this.context.getELContext();
  ValueExpression expression = component.getValueExpression("value");
  Property property = ELUtils.getProperty(expression, elContext);
  if (property == null) {
    return false;
  }
  BeanDescriptor beanConstraints = this.validator.getConstraintsForClass(property.getObjectType());
  PropertyDescriptor propertyConstraints = beanConstraints.getConstraintsForProperty(property.getName());
  return isRequired(propertyConstraints.getConstraintDescriptors());
}
origin: apache/servicemix-bundles

@Nullable
private MethodParameter resolveWriteMethodParameter() {
  if (getWriteMethod() == null) {
    return null;
  }
  return resolveParameterType(new MethodParameter(getWriteMethod(), 0));
}
origin: apache/servicemix-bundles

private Annotation[] resolveAnnotations() {
  Annotation[] annotations = annotationCache.get(this);
  if (annotations == null) {
    Map<Class<? extends Annotation>, Annotation> annotationMap = new LinkedHashMap<>();
    addAnnotationsToMap(annotationMap, getReadMethod());
    addAnnotationsToMap(annotationMap, getWriteMethod());
    addAnnotationsToMap(annotationMap, getField());
    annotations = annotationMap.values().toArray(new Annotation[0]);
    annotationCache.put(this, annotations);
  }
  return annotations;
}
origin: apache/servicemix-bundles

@Nullable
private Field getField() {
  String name = getName();
  if (!StringUtils.hasLength(name)) {
    return null;
  }
  Field field = null;
  Class<?> declaringClass = declaringClass();
  if (declaringClass != null) {
    field = ReflectionUtils.findField(declaringClass, name);
    if (field == null) {
      // Same lenient fallback checking as in CachedIntrospectionResults...
      field = ReflectionUtils.findField(declaringClass, StringUtils.uncapitalize(name));
      if (field == null) {
        field = ReflectionUtils.findField(declaringClass, StringUtils.capitalize(name));
      }
    }
  }
  return field;
}
origin: apache/servicemix-bundles

@Nullable
private MethodParameter resolveReadMethodParameter() {
  if (getReadMethod() == null) {
    return null;
  }
  return resolveParameterType(new MethodParameter(getReadMethod(), -1));
}
origin: org.springframework/spring-core

/**
 * Create a new type descriptor from a {@link Property}.
 * <p>Use this constructor when a source or target conversion point is a
 * property on a Java class.
 * @param property the property
 */
public TypeDescriptor(Property property) {
  Assert.notNull(property, "Property must not be null");
  this.resolvableType = ResolvableType.forMethodParameter(property.getMethodParameter());
  this.type = this.resolvableType.resolve(property.getType());
  this.annotatedElement = new AnnotatedElementAdapter(property.getAnnotations());
}
origin: org.springframework/spring-core

private Annotation[] resolveAnnotations() {
  Annotation[] annotations = annotationCache.get(this);
  if (annotations == null) {
    Map<Class<? extends Annotation>, Annotation> annotationMap = new LinkedHashMap<>();
    addAnnotationsToMap(annotationMap, getReadMethod());
    addAnnotationsToMap(annotationMap, getWriteMethod());
    addAnnotationsToMap(annotationMap, getField());
    annotations = annotationMap.values().toArray(new Annotation[0]);
    annotationCache.put(this, annotations);
  }
  return annotations;
}
origin: org.springframework/spring-core

@Nullable
private MethodParameter resolveWriteMethodParameter() {
  if (getWriteMethod() == null) {
    return null;
  }
  return resolveParameterType(new MethodParameter(getWriteMethod(), 0));
}
origin: org.springframework/spring-core

@Nullable
private Class<?> declaringClass() {
  if (getReadMethod() != null) {
    return getReadMethod().getDeclaringClass();
  }
  else if (getWriteMethod() != null) {
    return getWriteMethod().getDeclaringClass();
  }
  else {
    return null;
  }
}
origin: org.springframework/spring-core

@Nullable
private MethodParameter resolveReadMethodParameter() {
  if (getReadMethod() == null) {
    return null;
  }
  return resolveParameterType(new MethodParameter(getReadMethod(), -1));
}
origin: spring-projects/spring-framework

Property property = new Property(type, method, null);
TypeDescriptor typeDescriptor = new TypeDescriptor(property);
this.readerCache.put(cacheKey, new InvokerPair(method, typeDescriptor));
org.springframework.core.convertProperty

Javadoc

A description of a JavaBeans Property that allows us to avoid a dependency on java.beans.PropertyDescriptor. The java.beans package is not available in a number of environments (e.g. Android, Java ME), so this is desirable for portability of Spring's core conversion facility.

Used to build a TypeDescriptor from a property location. The built TypeDescriptor can then be used to convert from/to the property type.

Most used methods

  • <init>
  • getName
    The name of the property: e.g. 'foo'
  • getObjectType
    The object declaring this property, either directly or in a superclass the object extends.
  • declaringClass
  • getAnnotations
  • getField
  • getMethodParameter
  • getReadMethod
    The property getter method: e.g. getFoo()
  • getType
    The property type: e.g. java.lang.String
  • getWriteMethod
    The property setter method: e.g. setFoo(String)
  • resolveAnnotations
  • resolveMethodParameter
  • resolveAnnotations,
  • resolveMethodParameter,
  • resolveName,
  • resolveParameterType,
  • resolveReadMethodParameter,
  • resolveWriteMethodParameter,
  • addAnnotationsToMap

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • runOnUiThread (Activity)
  • findViewById (Activity)
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top Sublime Text 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