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

Method coerceToByte

java/org/apache/jasper/compiler/JspUtil.java:443–455  ·  view source on GitHub ↗

Generates code to coerce a string to a Byte object. @param s The string expression @param isNamedAttribute Whether the value comes from a named attribute @return the generated coercion code

(String s, boolean isNamedAttribute)

Source from the content-addressed store, hash-verified

441 * @return the generated coercion code
442 */
443 public static String coerceToByte(String s, boolean isNamedAttribute) {
444 if (isNamedAttribute) {
445 return "(java.lang.Byte) org.apache.jasper.runtime.JspRuntimeLibrary.coerce(" + s +
446 ", java.lang.Byte.class)";
447 } else {
448 if (s == null || s.isEmpty()) {
449 return "java.lang.Byte.valueOf((byte) 0)";
450 } else {
451 // Detect format error at translation time
452 return "java.lang.Byte.valueOf(" + Generator.quote(s) + ")";
453 }
454 }
455 }
456
457 /**
458 * Generates code to coerce a string to a primitive char value.

Callers 1

convertStringMethod · 0.95

Calls 2

quoteMethod · 0.95
isEmptyMethod · 0.45

Tested by

no test coverage detected