MCPcopy Index your code
hub / github.com/apache/tomcat / convertToType

Method convertToType

java/jakarta/el/ELContext.java:356–377  ·  view source on GitHub ↗

Coerce the supplied object to the requested type. @param The type to which the object should be coerced @param obj The object to be coerced @param type The type to which the object should be coerced @return An instance of the requested type. @throws ELException If the conversion fails @sin

(Object obj, Class<T> type)

Source from the content-addressed store, hash-verified

354 * @since EL 3.0
355 */
356 public <T> T convertToType(Object obj, Class<T> type) {
357
358 boolean originalResolved = isPropertyResolved();
359 setPropertyResolved(false);
360 try {
361 ELResolver resolver = getELResolver();
362 if (resolver != null) {
363 T result = resolver.convertToType(this, obj, type);
364 if (isPropertyResolved()) {
365 return result;
366 }
367 }
368 } finally {
369 setPropertyResolved(originalResolved);
370 }
371
372 if (obj instanceof LambdaExpression && isFunctionalInterface(type)) {
373 ((LambdaExpression) obj).setELContext(this);
374 }
375
376 return ELManager.getExpressionFactory().coerceToType(obj, type);
377 }
378
379
380 /*

Callers 2

isCoercibleFromMethod · 0.45
buildParametersMethod · 0.45

Calls 8

isPropertyResolvedMethod · 0.95
setPropertyResolvedMethod · 0.95
getELResolverMethod · 0.95
convertToTypeMethod · 0.95
isFunctionalInterfaceMethod · 0.95
getExpressionFactoryMethod · 0.95
setELContextMethod · 0.45
coerceToTypeMethod · 0.45

Tested by

no test coverage detected