Tabnine Logo
org.springframework.core.convert
Code IndexAdd Tabnine to your IDE (free)

How to use org.springframework.core.convert

Best Java code snippets using org.springframework.core.convert (Showing top 20 results out of 1,260)

origin: spring-projects/spring-framework

@Override
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
  return (targetType.getElementTypeDescriptor() == null ||
      this.conversionService.canConvert(sourceType, targetType.getElementTypeDescriptor()));
}
origin: spring-projects/spring-framework

private boolean matchesFromByteBuffer(TypeDescriptor targetType) {
  return (targetType.isAssignableTo(BYTE_ARRAY_TYPE) ||
      this.conversionService.canConvert(BYTE_ARRAY_TYPE, targetType));
}
origin: spring-projects/spring-framework

Annotation[] getAnnotations() {
  if (this.annotations == null) {
    this.annotations = resolveAnnotations();
  }
  return this.annotations;
}
origin: spring-projects/spring-framework

@Override
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
  for (Class<?> interfaceType : ClassUtils.getAllInterfacesForClassAsSet(sourceType.getType())) {
    if (this.conversionService.canConvert(TypeDescriptor.valueOf(interfaceType), targetType)) {
      return false;
    }
  }
  return true;
}
origin: spring-projects/spring-framework

@Nullable
private Object convertValue(Object sourceValue, TypeDescriptor sourceType, @Nullable TypeDescriptor targetType) {
  if (targetType == null) {
    return sourceValue;
  }
  return this.conversionService.convert(sourceValue, sourceType.getMapValueTypeDescriptor(sourceValue), targetType);
}
origin: spring-projects/spring-framework

@Nullable
private Object convertKey(Object sourceKey, TypeDescriptor sourceType, @Nullable TypeDescriptor targetType) {
  if (targetType == null) {
    return sourceKey;
  }
  return this.conversionService.convert(sourceKey, sourceType.getMapKeyTypeDescriptor(sourceKey), targetType);
}
origin: spring-projects/spring-framework

  @Override
  public Object convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType) throws EvaluationException {
    return this.service.convert(value, sourceType, targetType);
  }
}
origin: spring-projects/spring-framework

@Override
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, Object rootObject)
    throws EvaluationException {
  return TypeDescriptor.valueOf(String.class);
}
origin: spring-projects/spring-framework

@Override
public boolean canConvert(TypeDescriptor sourceTypeDescriptor, TypeDescriptor targetTypeDescriptor) {
  if (conversionService.canConvert(sourceTypeDescriptor, targetTypeDescriptor)) {
    return true;
  }
  // TODO: what does this mean? This method is not used in SpEL so probably ignorable?
  Class<?> sourceType = sourceTypeDescriptor.getObjectType();
  Class<?> targetType = targetTypeDescriptor.getObjectType();
  return canConvert(sourceType, targetType);
}
origin: spring-projects/spring-framework

/**
 * Validate that a {@link Collection} of the elements held within the stream can be
 * converted to the specified {@code targetType}.
 * @param elementType the type of the stream elements
 * @param targetType the type to convert to
 */
public boolean matchesFromStream(@Nullable TypeDescriptor elementType, TypeDescriptor targetType) {
  TypeDescriptor collectionOfElement = TypeDescriptor.collection(Collection.class, elementType);
  return this.conversionService.canConvert(collectionOfElement, targetType);
}
origin: spring-projects/spring-framework

  @Override
  protected Object convertNullSource(TypeDescriptor sourceType, TypeDescriptor targetType) {
    return targetType.getType() == Boolean.class ? false : null;
  }
};
origin: spring-projects/spring-framework

  @Override
  public String toString() {
    return TypeDescriptor.this.toString();
  }
}
origin: spring-projects/spring-framework

@Override
public boolean equals(Object other) {
  if (this == other) {
    return true;
  }
  if (!(other instanceof ConverterCacheKey)) {
    return false;
  }
  ConverterCacheKey otherKey = (ConverterCacheKey) other;
  return (this.sourceType.equals(otherKey.sourceType)) &&
      this.targetType.equals(otherKey.targetType);
}
origin: spring-projects/spring-framework

/**
 * Return the annotations associated with this type descriptor, if any.
 * @return the annotations, or an empty array if none
 */
public Annotation[] getAnnotations() {
  return this.annotatedElement.getAnnotations();
}
origin: spring-projects/spring-framework

@MethodAnnotation1
public Map<List<Integer>, List<Long>> getProperty() {
  return property;
}
origin: spring-projects/spring-framework

private boolean matchesToByteBuffer(TypeDescriptor sourceType) {
  return (sourceType.isAssignableTo(BYTE_ARRAY_TYPE) ||
      this.conversionService.canConvert(sourceType, BYTE_ARRAY_TYPE));
}
origin: spring-projects/spring-framework

@Override
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, Object rootObject) throws EvaluationException {
  return TypeDescriptor.valueOf(String.class);
}
origin: spring-projects/spring-framework

/**
 * Validate that the specified {@code sourceType} can be converted to a {@link Collection} of
 * the type of the stream elements.
 * @param elementType the type of the stream elements
 * @param sourceType the type to convert from
 */
public boolean matchesToStream(@Nullable TypeDescriptor elementType, TypeDescriptor sourceType) {
  TypeDescriptor collectionOfElement = TypeDescriptor.collection(Collection.class, elementType);
  return this.conversionService.canConvert(sourceType, collectionOfElement);
}
origin: spring-projects/spring-framework

@Override
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context) {
  return TypeDescriptor.valueOf(String.class);
}
origin: spring-projects/spring-framework

@Override
public TypeDescriptor getValueTypeDescriptor() {
  return TypeDescriptor.valueOf(String.class);
}
org.springframework.core.convert

Most used classes

  • ConversionService
    A service interface for type conversion. This is the entry point into the convert system. Call #conv
  • TypeDescriptor
    Context about a type to convert from or to.
  • DefaultConversionService
    A specialization of GenericConversionService configured by default with converters appropriate for m
  • Converter
    A converter converts a source object of type S to a target of type T. Implementations of this interf
  • GenericConversionService
    Base ConversionService implementation suitable for use in most environments. Indirectly implements C
  • ConverterRegistry,
  • ConversionFailedException,
  • ConfigurableConversionService,
  • Property,
  • GenericConverter,
  • ConvertingPropertyEditorAdapter,
  • ConversionServiceFactory,
  • ConditionalGenericConverter,
  • ConvertingComparator,
  • ArrayToArrayConverter,
  • ArrayToCollectionConverter,
  • CollectionToArrayConverter,
  • CollectionToCollectionConverter,
  • CollectionToObjectConverter
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