View Javadoc

1   package org.lsst.ccs.config;
2   
3   import org.lsst.gruth.jutils.ComponentNode;
4   import org.lsst.gruth.nodes.Utils;
5   
6   import java.io.Serializable;
7   
8   /**
9    * Object to store both a text source for a Subsystem description and the binary data extracted
10   * from it (type <TT>ComponentNode</TT>)
11   * @author bamade
12   */
13  // Date: 20/06/12
14  
15  
16  public class TextAndNode  implements Serializable {
17      private static final long serialVersionUID = -4705364076252108833L;
18      String codeSource;
19      ComponentNode componentNode ;
20  
21      public TextAndNode(String codeSource, ComponentNode componentNode) {
22          this.codeSource = codeSource;
23          this.componentNode = componentNode;
24      }
25  
26      public TextAndNode(Object objSource) {
27          if(! (objSource instanceof String)) {
28              throw new IllegalArgumentException("TextAndNode ctor accepts String but is " + objSource.getClass()) ;
29          }
30          String source = (String) objSource;
31          ComponentNode node = Utils.getComponentNodeFromGroovy(source) ;
32          this.codeSource = source ;
33          this.componentNode = node ;
34      }
35  
36  
37      public String getCodeSource() {
38          return codeSource;
39      }
40  
41       void setCodeSource(String codeSource) {
42          this.codeSource = codeSource;
43      }
44  
45      public ComponentNode getComponentNode() {
46          return componentNode;
47      }
48  
49       void setComponentNode(ComponentNode componentNode) {
50          this.componentNode = componentNode;
51      }
52  }