01: package org.mvel;
02:
03: import org.mvel.integration.VariableResolverFactory;
04: import org.mvel.util.ParseTools;
05:
06: /**
07: * @author Christopher Brock
08: */
09: public class ExecutableLiteral implements ExecutableStatement {
10: private Object literal;
11: private int integer32;
12: private boolean intOptimized;
13:
14: public ExecutableLiteral(Object literal) {
15: this .literal = ParseTools.handleParserEgress(literal, false);
16: }
17:
18: public ExecutableLiteral(int literal) {
19: this .literal = this .integer32 = literal;
20: this .intOptimized = true;
21: }
22:
23: public int getInteger32() {
24: return integer32;
25: }
26:
27: public void setInteger32(int integer32) {
28: this .integer32 = integer32;
29: }
30:
31: public Object getValue(Object staticContext,
32: VariableResolverFactory factory) {
33: return literal;
34: }
35:
36: public void setKnownIngressType(Class type) {
37:
38: }
39:
40: public void setKnownEgressType(Class type) {
41:
42: }
43:
44: public Class getKnownIngressType() {
45: return null;
46: }
47:
48: public Class getKnownEgressType() {
49: return this .literal.getClass();
50: }
51:
52: public boolean isConvertableIngressEgress() {
53: return false;
54: }
55:
56: public void computeTypeConversionRule() {
57:
58: }
59:
60: public Object getValue(Object ctx, Object elCtx,
61: VariableResolverFactory variableFactory) {
62: return literal;
63: }
64:
65: public Object getLiteral() {
66: return literal;
67: }
68:
69: public boolean intOptimized() {
70: return intOptimized;
71: }
72:
73: public Object setValue(Object ctx, Object elCtx,
74: VariableResolverFactory variableFactory, Object value) {
75: // not implemented
76: return null;
77: }
78: }
|