BrightSide Workbench Full Report + Source Code
org.turro.configuration.Path Class Referenceabstract
Inheritance diagram for org.turro.configuration.Path:
Collaboration diagram for org.turro.configuration.Path:

Public Member Functions

 Path (String path)
 
 Path (String[] nodes)
 
Document getDoc ()
 
void setDoc (Document doc)
 
Element getNode (boolean create) throws JDOMException
 
void delNode (String path) throws JDOMException
 
List< String > getChildrenValue (String element, String name) throws JDOMException
 
List< String[]> getChildrenValues (String element, String names[]) throws JDOMException
 
String getNodeValue (String name) throws JDOMException
 
String[] getNodeValues (String names[]) throws JDOMException
 
void setChildrenValue (String element, String name, List< String > values) throws JDOMException
 
void setChildrenValues (String element, String names[], List< String[]> values) throws JDOMException
 
void setNodeValue (String name, String value) throws JDOMException
 
void setNodeValues (String names[], String[] values) throws JDOMException
 

Protected Member Functions

abstract Element createNode (Element root, String path, int index)
 

Protected Attributes

String nodes []
 
Document doc
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 32 of file Path.java.

Constructor & Destructor Documentation

◆ Path() [1/2]

org.turro.configuration.Path.Path ( String  path)

Definition at line 37 of file Path.java.

37  {
38  if(path.startsWith("/")) {
39  nodes = path.substring(1).split("/");
40  } else {
41  nodes = path.split("/");
42  }
43  }

◆ Path() [2/2]

org.turro.configuration.Path.Path ( String[]  nodes)

Definition at line 45 of file Path.java.

45  {
46  this.nodes = nodes;
47  }

Member Function Documentation

◆ createNode()

abstract Element org.turro.configuration.Path.createNode ( Element  root,
String  path,
int  index 
)
abstractprotected

Reimplemented in org.turro.zkoss.filter.FilterPath, and org.turro.zkoss.filter.FilterNamePath.

Here is the caller graph for this function:

◆ delNode()

void org.turro.configuration.Path.delNode ( String  path) throws JDOMException

Definition at line 72 of file Path.java.

72  {
73  Object obj = XPath.selectSingleNode(doc.getRootElement(), path);
74  if(obj instanceof Content) {
75  ((Content) obj).detach();
76  }
77  }
Here is the caller graph for this function:

◆ getChildrenValue()

List<String> org.turro.configuration.Path.getChildrenValue ( String  element,
String  name 
) throws JDOMException

Definition at line 79 of file Path.java.

79  {
80  ArrayList<String> list = new ArrayList<String>();
81  Element el = getNode(true);
82  for(Element cel : (List<Element>) el.getChildren(element)) {
83  list.add(cel.getAttributeValue(name));
84  }
85  return list;
86  }
Element getNode(boolean create)
Definition: Path.java:57
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getChildrenValues()

List<String[]> org.turro.configuration.Path.getChildrenValues ( String  element,
String  names[] 
) throws JDOMException

Definition at line 88 of file Path.java.

88  {
89  ArrayList<String[]> list = new ArrayList<String[]>();
90  Element el = getNode(true);
91  for(Element cel : (List<Element>) el.getChildren(element)) {
92  ArrayList<String> l = new ArrayList<String>();
93  for(int i = 0; i < names.length; i++) {
94  l.add(cel.getAttributeValue(names[i]));
95  }
96  list.add(l.toArray(new String[0]));
97  }
98  return list;
99  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDoc()

Document org.turro.configuration.Path.getDoc ( )

Definition at line 49 of file Path.java.

49  {
50  return doc;
51  }

◆ getNode()

Element org.turro.configuration.Path.getNode ( boolean  create) throws JDOMException

Definition at line 57 of file Path.java.

57  {
58  Element curr = doc.getRootElement();
59  int count = 0;
60  for(String node : nodes) {
61  Element tmp = (Element) XPath.selectSingleNode(curr, node);
62  if(tmp == null && create) {
63  tmp = createNode(curr, node, count);
64  }
65  if(tmp == null) return null;
66  curr = tmp;
67  count++;
68  }
69  return curr;
70  }
abstract Element createNode(Element root, String path, int index)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNodeValue()

String org.turro.configuration.Path.getNodeValue ( String  name) throws JDOMException

Definition at line 101 of file Path.java.

101  {
102  Element el = getNode(true);
103  return el.getAttributeValue(name);
104  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNodeValues()

String [] org.turro.configuration.Path.getNodeValues ( String  names[]) throws JDOMException

Definition at line 106 of file Path.java.

106  {
107  Element el = getNode(true);
108  ArrayList<String> l = new ArrayList<String>();
109  for(int i = 0; i < names.length; i++) {
110  l.add(el.getAttributeValue(names[i]));
111  }
112  return l.toArray(new String[0]);
113  }
Here is the call graph for this function:

◆ setChildrenValue()

void org.turro.configuration.Path.setChildrenValue ( String  element,
String  name,
List< String >  values 
) throws JDOMException

Definition at line 115 of file Path.java.

115  {
116  Element el = getNode(true);
117  el.removeContent();
118  for(String v : values) {
119  Element nel = new Element(element);
120  nel.setAttribute(name, v);
121  el.addContent(nel);
122  }
123  }

◆ setChildrenValues()

void org.turro.configuration.Path.setChildrenValues ( String  element,
String  names[],
List< String[]>  values 
) throws JDOMException

Definition at line 125 of file Path.java.

125  {
126  Element el = getNode(true);
127  el.removeContent();
128  for(String[] vs : values) {
129  Element nel = new Element(element);
130  for(int i = 0; i < names.length; i++) {
131  nel.setAttribute(names[i], vs[i]);
132  }
133  el.addContent(nel);
134  }
135  }

◆ setDoc()

void org.turro.configuration.Path.setDoc ( Document  doc)

Definition at line 53 of file Path.java.

53  {
54  this.doc = doc;
55  }
Here is the caller graph for this function:

◆ setNodeValue()

void org.turro.configuration.Path.setNodeValue ( String  name,
String  value 
) throws JDOMException

Definition at line 137 of file Path.java.

137  {
138  Element el = getNode(true);
139  el.setAttribute(name, value);
140  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNodeValues()

void org.turro.configuration.Path.setNodeValues ( String  names[],
String[]  values 
) throws JDOMException

Definition at line 142 of file Path.java.

142  {
143  Element el = getNode(true);
144  for(int i = 0; i < names.length; i++) {
145  el.setAttribute(names[i], values[i]);
146  }
147  }

Member Data Documentation

◆ doc

Document org.turro.configuration.Path.doc
protected

Definition at line 35 of file Path.java.

◆ nodes

String org.turro.configuration.Path.nodes[]
protected

Definition at line 34 of file Path.java.


The documentation for this class was generated from the following file: