/** * Create an array of descriptors from an array of classes. * @param types the input array of classes * @return an array of descriptors */ public static String[] toDescriptors(Class<?>[] types) { int typesCount = types.length; String[] descriptors = new String[typesCount]; for (int p = 0; p < typesCount; p++) { descriptors[p] = toDescriptor(types[p]); } return descriptors; }
/** * Determine the descriptor for an object instance (or {@code null}). * @param value an object (possibly {@code null}) * @return the type descriptor for the object * (descriptor is "Ljava/lang/Object" for {@code null} value) */ public static String toDescriptorFromObject(@Nullable Object value) { if (value == null) { return "Ljava/lang/Object"; } else { return toDescriptor(value.getClass()); } }
/** * Create an array of descriptors from an array of classes. * @param types the input array of classes * @return an array of descriptors */ public static String[] toDescriptors(Class<?>[] types) { int typesCount = types.length; String[] descriptors = new String[typesCount]; for (int p = 0; p < typesCount; p++) { descriptors[p] = toDescriptor(types[p]); } return descriptors; }
@Override public TypedValue getValue() { Object value = this.map.get(this.key); exitTypeDescriptor = CodeFlow.toDescriptor(Object.class); return new TypedValue(value, this.mapEntryDescriptor.getMapValueTypeDescriptor(value)); }
/** * Determine the descriptor for an object instance (or {@code null}). * @param value an object (possibly {@code null}) * @return the type descriptor for the object * (descriptor is "Ljava/lang/Object" for {@code null} value) */ public static String toDescriptorFromObject(@Nullable Object value) { if (value == null) { return "Ljava/lang/Object"; } else { return toDescriptor(value.getClass()); } }
@Override public TypedValue getValue() { TypedValue value = this.ref.getValueInternal(this.contextObject, this.evalContext, this.autoGrowNullReferences); PropertyAccessor accessorToUse = this.ref.cachedReadAccessor; if (accessorToUse instanceof CompilablePropertyAccessor) { this.ref.setExitTypeDescriptor(CodeFlow.toDescriptor(((CompilablePropertyAccessor) accessorToUse).getPropertyType())); } return value; }
@Override public TypedValue getValue() { Object value = this.map.get(this.key); exitTypeDescriptor = CodeFlow.toDescriptor(Object.class); return new TypedValue(value, this.mapEntryDescriptor.getMapValueTypeDescriptor(value)); }
@Override public TypedValue getValue() { growCollectionIfNecessary(); if (this.collection instanceof List) { Object o = ((List) this.collection).get(this.index); exitTypeDescriptor = CodeFlow.toDescriptor(Object.class); return new TypedValue(o, this.collectionEntryDescriptor.elementTypeDescriptor(o)); } int pos = 0; for (Object o : this.collection) { if (pos == this.index) { return new TypedValue(o, this.collectionEntryDescriptor.elementTypeDescriptor(o)); } pos++; } throw new IllegalStateException("Failed to find indexed element " + this.index + ": " + this.collection); }
private void updateExitTypeDescriptor() { CachedMethodExecutor executorToCheck = this.cachedExecutor; if (executorToCheck != null && executorToCheck.get() instanceof ReflectiveMethodExecutor) { Method method = ((ReflectiveMethodExecutor) executorToCheck.get()).getMethod(); String descriptor = CodeFlow.toDescriptor(method.getReturnType()); if (this.nullSafe && CodeFlow.isPrimitive(descriptor)) { this.originalPrimitiveExitTypeDescriptor = descriptor; this.exitTypeDescriptor = CodeFlow.toBoxedDescriptor(descriptor); } else { this.exitTypeDescriptor = descriptor; } } }
@Override public TypedValue getValue() { TypedValue value = this.ref.getValueInternal(this.contextObject, this.evalContext, this.autoGrowNullReferences); PropertyAccessor accessorToUse = this.ref.cachedReadAccessor; if (accessorToUse instanceof CompilablePropertyAccessor) { this.ref.setExitTypeDescriptor(CodeFlow.toDescriptor(((CompilablePropertyAccessor) accessorToUse).getPropertyType())); } return value; }
this.exitTypeDescriptor = CodeFlow.toDescriptor(method.getReturnType()); this.method = method;
@Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { TypedValue tv = getValueInternal(state.getActiveContextObject(), state.getEvaluationContext(), state.getConfiguration().isAutoGrowNullReferences()); PropertyAccessor accessorToUse = this.cachedReadAccessor; if (accessorToUse instanceof CompilablePropertyAccessor) { CompilablePropertyAccessor accessor = (CompilablePropertyAccessor) accessorToUse; setExitTypeDescriptor(CodeFlow.toDescriptor(accessor.getPropertyType())); } return tv; }
@Override public TypedValue getValue() { growCollectionIfNecessary(); if (this.collection instanceof List) { Object o = ((List) this.collection).get(this.index); exitTypeDescriptor = CodeFlow.toDescriptor(Object.class); return new TypedValue(o, this.collectionEntryDescriptor.elementTypeDescriptor(o)); } int pos = 0; for (Object o : this.collection) { if (pos == this.index) { return new TypedValue(o, this.collectionEntryDescriptor.elementTypeDescriptor(o)); } pos++; } throw new IllegalStateException("Failed to find indexed element " + this.index + ": " + this.collection); }
(ReflectivePropertyAccessor.OptimalPropertyAccessor) accessor; Member member = optimalAccessor.member; Indexer.this.exitTypeDescriptor = CodeFlow.toDescriptor(member instanceof Method ? ((Method) member).getReturnType() : ((Field) member).getType());
private void updateExitTypeDescriptor() { CachedMethodExecutor executorToCheck = this.cachedExecutor; if (executorToCheck != null && executorToCheck.get() instanceof ReflectiveMethodExecutor) { Method method = ((ReflectiveMethodExecutor) executorToCheck.get()).getMethod(); String descriptor = CodeFlow.toDescriptor(method.getReturnType()); if (this.nullSafe && CodeFlow.isPrimitive(descriptor)) { this.originalPrimitiveExitTypeDescriptor = descriptor; this.exitTypeDescriptor = CodeFlow.toBoxedDescriptor(descriptor); } else { this.exitTypeDescriptor = descriptor; } } }
checkAccess(array.length, idx); Object retValue = array[idx]; this.exitTypeDescriptor = CodeFlow.toDescriptor(arrayComponentType); return retValue;
this.exitTypeDescriptor = CodeFlow.toDescriptor(method.getReturnType()); this.method = method;
@Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { TypedValue tv = getValueInternal(state.getActiveContextObject(), state.getEvaluationContext(), state.getConfiguration().isAutoGrowNullReferences()); PropertyAccessor accessorToUse = this.cachedReadAccessor; if (accessorToUse instanceof CompilablePropertyAccessor) { CompilablePropertyAccessor accessor = (CompilablePropertyAccessor) accessorToUse; setExitTypeDescriptor(CodeFlow.toDescriptor(accessor.getPropertyType())); } return tv; }
this.cachedExecutor = executorToUse; if (executorToUse instanceof ReflectiveConstructorExecutor) { this.exitTypeDescriptor = CodeFlow.toDescriptor( ((ReflectiveConstructorExecutor) executorToUse).getConstructor().getDeclaringClass());
(ReflectivePropertyAccessor.OptimalPropertyAccessor) accessor; Member member = optimalAccessor.member; Indexer.this.exitTypeDescriptor = CodeFlow.toDescriptor(member instanceof Method ? ((Method) member).getReturnType() : ((Field) member).getType());