@Override public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { return (targetType.getElementTypeDescriptor() == null || this.conversionService.canConvert(sourceType, targetType.getElementTypeDescriptor())); }
private boolean matchesFromByteBuffer(TypeDescriptor targetType) { return (targetType.isAssignableTo(BYTE_ARRAY_TYPE) || this.conversionService.canConvert(BYTE_ARRAY_TYPE, targetType)); }
Annotation[] getAnnotations() { if (this.annotations == null) { this.annotations = resolveAnnotations(); } return this.annotations; }
@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; }
@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); }
@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); }
@Override public Object convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType) throws EvaluationException { return this.service.convert(value, sourceType, targetType); } }
@Override public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, Object rootObject) throws EvaluationException { return TypeDescriptor.valueOf(String.class); }
@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); }
/** * 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); }
@Override protected Object convertNullSource(TypeDescriptor sourceType, TypeDescriptor targetType) { return targetType.getType() == Boolean.class ? false : null; } };
@Override public String toString() { return TypeDescriptor.this.toString(); } }
@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); }
/** * 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(); }
@MethodAnnotation1 public Map<List<Integer>, List<Long>> getProperty() { return property; }
private boolean matchesToByteBuffer(TypeDescriptor sourceType) { return (sourceType.isAssignableTo(BYTE_ARRAY_TYPE) || this.conversionService.canConvert(sourceType, BYTE_ARRAY_TYPE)); }
@Override public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, Object rootObject) throws EvaluationException { return TypeDescriptor.valueOf(String.class); }
/** * 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); }
@Override public TypeDescriptor getValueTypeDescriptor(EvaluationContext context) { return TypeDescriptor.valueOf(String.class); }
@Override public TypeDescriptor getValueTypeDescriptor() { return TypeDescriptor.valueOf(String.class); }