1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.view.facelets.compiler;
20
21 import java.io.IOException;
22 import javax.el.ELContext;
23 import javax.el.ExpressionFactory;
24 import javax.faces.context.FacesContext;
25
26
27
28
29
30
31
32 final class CompositeTextInstruction implements Instruction
33 {
34 private Instruction[] instructions;
35
36 public CompositeTextInstruction(Instruction[] instructions)
37 {
38 this.instructions = instructions;
39 }
40
41 @Override
42 public void write(FacesContext context) throws IOException
43 {
44 for (Instruction i : instructions)
45 {
46 i.write(context);
47 }
48 }
49
50 @Override
51 public Instruction apply(ExpressionFactory factory, ELContext ctx)
52 {
53 Instruction[] array = new Instruction[instructions.length];
54 for (int i = 0; i < instructions.length; i++)
55 {
56 array[i] = instructions[i].apply(factory, ctx);
57 }
58 return new CompositeTextInstruction(array);
59 }
60
61 @Override
62 public boolean isLiteral()
63 {
64 boolean literal = true;
65 for (Instruction i : instructions)
66 {
67 if (!i.isLiteral())
68 {
69 literal = false;
70 break;
71 }
72 }
73 return literal;
74 }
75
76 }