Java Code Examples for org.springframework.expression.spel.SpelMessage#INDEXING_NOT_SUPPORTED_FOR_TYPE
The following examples show how to use
org.springframework.expression.spel.SpelMessage#INDEXING_NOT_SUPPORTED_FOR_TYPE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Indexer.java From spring-analysis-note with MIT License | 6 votes |
@Override public void setValue(@Nullable Object newValue) { growCollectionIfNecessary(); if (this.collection instanceof List) { List list = (List) this.collection; if (this.collectionEntryDescriptor.getElementTypeDescriptor() != null) { newValue = this.typeConverter.convertValue(newValue, TypeDescriptor.forObject(newValue), this.collectionEntryDescriptor.getElementTypeDescriptor()); } list.set(this.index, newValue); } else { throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, this.collectionEntryDescriptor.toString()); } }
Example 2
Source File: Indexer.java From java-technology-stack with MIT License | 6 votes |
@Override public void setValue(@Nullable Object newValue) { growCollectionIfNecessary(); if (this.collection instanceof List) { List list = (List) this.collection; if (this.collectionEntryDescriptor.getElementTypeDescriptor() != null) { newValue = this.typeConverter.convertValue(newValue, TypeDescriptor.forObject(newValue), this.collectionEntryDescriptor.getElementTypeDescriptor()); } list.set(this.index, newValue); } else { throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, this.collectionEntryDescriptor.toString()); } }
Example 3
Source File: Indexer.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public void setValue(Object newValue) { growCollectionIfNecessary(); if (this.collection instanceof List) { List list = (List) this.collection; if (this.collectionEntryDescriptor.getElementTypeDescriptor() != null) { newValue = this.typeConverter.convertValue(newValue, TypeDescriptor.forObject(newValue), this.collectionEntryDescriptor.getElementTypeDescriptor()); } list.set(this.index, newValue); } else { throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, this.collectionEntryDescriptor.toString()); } }
Example 4
Source File: Indexer.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Override public void setValue(Object newValue) { growCollectionIfNecessary(); if (this.collection instanceof List) { List list = (List) this.collection; if (this.collectionEntryDescriptor.getElementTypeDescriptor() != null) { newValue = this.typeConverter.convertValue(newValue, TypeDescriptor.forObject(newValue), this.collectionEntryDescriptor.getElementTypeDescriptor()); } list.set(this.index, newValue); } else { throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, this.collectionEntryDescriptor.toString()); } }
Example 5
Source File: Indexer.java From spring-analysis-note with MIT License | 4 votes |
@Override public void setValue(@Nullable Object newValue) { throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, this.typeDescriptor.toString()); }
Example 6
Source File: Indexer.java From java-technology-stack with MIT License | 4 votes |
@Override public void setValue(@Nullable Object newValue) { throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, this.typeDescriptor.toString()); }
Example 7
Source File: Indexer.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public TypedValue getValue() { Class<?> targetObjectRuntimeClass = getObjectClass(this.targetObject); try { if (Indexer.this.cachedReadName != null && Indexer.this.cachedReadName.equals(this.name) && Indexer.this.cachedReadTargetType != null && Indexer.this.cachedReadTargetType.equals(targetObjectRuntimeClass)) { // It is OK to use the cached accessor return Indexer.this.cachedReadAccessor.read(this.evaluationContext, this.targetObject, this.name); } List<PropertyAccessor> accessorsToTry = AstUtils.getPropertyAccessorsToTry( targetObjectRuntimeClass, this.evaluationContext.getPropertyAccessors()); if (accessorsToTry != null) { for (PropertyAccessor accessor : accessorsToTry) { if (accessor.canRead(this.evaluationContext, this.targetObject, this.name)) { if (accessor instanceof ReflectivePropertyAccessor) { accessor = ((ReflectivePropertyAccessor) accessor).createOptimalAccessor( this.evaluationContext, this.targetObject, this.name); } Indexer.this.cachedReadAccessor = accessor; Indexer.this.cachedReadName = this.name; Indexer.this.cachedReadTargetType = targetObjectRuntimeClass; if (accessor instanceof ReflectivePropertyAccessor.OptimalPropertyAccessor) { ReflectivePropertyAccessor.OptimalPropertyAccessor optimalAccessor = (ReflectivePropertyAccessor.OptimalPropertyAccessor) accessor; Member member = optimalAccessor.member; Indexer.this.exitTypeDescriptor = CodeFlow.toDescriptor(member instanceof Method ? ((Method) member).getReturnType() : ((Field) member).getType()); } return accessor.read(this.evaluationContext, this.targetObject, this.name); } } } } catch (AccessException ex) { throw new SpelEvaluationException(getStartPosition(), ex, SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, this.targetObjectTypeDescriptor.toString()); } throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, this.targetObjectTypeDescriptor.toString()); }
Example 8
Source File: Indexer.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void setValue(Object newValue) { throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, this.typeDescriptor.toString()); }
Example 9
Source File: Indexer.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public TypedValue getValue() { Class<?> targetObjectRuntimeClass = getObjectClass(this.targetObject); try { if (Indexer.this.cachedReadName != null && Indexer.this.cachedReadName.equals(this.name) && Indexer.this.cachedReadTargetType != null && Indexer.this.cachedReadTargetType.equals(targetObjectRuntimeClass)) { // It is OK to use the cached accessor return Indexer.this.cachedReadAccessor.read(this.evaluationContext, this.targetObject, this.name); } List<PropertyAccessor> accessorsToTry = AstUtils.getPropertyAccessorsToTry( targetObjectRuntimeClass, this.evaluationContext.getPropertyAccessors()); if (accessorsToTry != null) { for (PropertyAccessor accessor : accessorsToTry) { if (accessor.canRead(this.evaluationContext, this.targetObject, this.name)) { if (accessor instanceof ReflectivePropertyAccessor) { accessor = ((ReflectivePropertyAccessor) accessor).createOptimalAccessor( this.evaluationContext, this.targetObject, this.name); } Indexer.this.cachedReadAccessor = accessor; Indexer.this.cachedReadName = this.name; Indexer.this.cachedReadTargetType = targetObjectRuntimeClass; if (accessor instanceof ReflectivePropertyAccessor.OptimalPropertyAccessor) { ReflectivePropertyAccessor.OptimalPropertyAccessor optimalAccessor = (ReflectivePropertyAccessor.OptimalPropertyAccessor) accessor; Member member = optimalAccessor.member; Indexer.this.exitTypeDescriptor = CodeFlow.toDescriptor(member instanceof Method ? ((Method) member).getReturnType() : ((Field) member).getType()); } return accessor.read(this.evaluationContext, this.targetObject, this.name); } } } } catch (AccessException ex) { throw new SpelEvaluationException(getStartPosition(), ex, SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, this.targetObjectTypeDescriptor.toString()); } throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, this.targetObjectTypeDescriptor.toString()); }
Example 10
Source File: Indexer.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public void setValue(Object newValue) { throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE, this.typeDescriptor.toString()); }