this.name = encName; this.entryType = entryType; this.value = value;
Class type = Thread.currentThread().getContextClassLoader().loadClass(entryType); if (type == String.class) { return value; } else if (type == Integer.class) { return new Integer(value); } else if (type == Long.class) { return new Long(value); } else if (type == Double.class) { return new Double(value); } else if (type == Float.class) { return new Float(value); } else if (type == Byte.class) { return new Byte(value); } else if (type == Character.class) { String input = value; if (input == null || input.length() == 0) { return new Character((char) 0); } else { if (input.length() > 1) // TODO: Add deployment context log.warn("Warning character env-entry is too long: binding=" + name + " value=" + input); return new Character(input.charAt(0)); } } else if (type == Short.class) { return new Short(value); } else if (type == Boolean.class) { return new Boolean(value); } else { return value; }
try { Util.rebind(container.getEnc(), name, getEnvEntryValue()); } catch (Exception e) { throw new RuntimeException("Invalid <env-entry> name: " + name, e); }