|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ElementModelImpl.java | 91.7% | 100% | 100% | 97.4% |
|
1 |
// Copyright 2004 The Apache Software Foundation
|
|
2 |
//
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
5 |
// You may obtain a copy of the License at
|
|
6 |
//
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
//
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12 |
// See the License for the specific language governing permissions and
|
|
13 |
// limitations under the License.
|
|
14 |
|
|
15 |
package org.apache.hivemind.schema.impl;
|
|
16 |
|
|
17 |
import java.util.ArrayList;
|
|
18 |
import java.util.Collections;
|
|
19 |
import java.util.List;
|
|
20 |
|
|
21 |
import org.apache.hivemind.schema.AttributeModel;
|
|
22 |
import org.apache.hivemind.schema.ElementModel;
|
|
23 |
import org.apache.hivemind.schema.Rule;
|
|
24 |
|
|
25 |
/**
|
|
26 |
* Implementation of {@link org.apache.hivemind.schema.ElementModel}.
|
|
27 |
*
|
|
28 |
* @author Howard Lewis Ship
|
|
29 |
*/
|
|
30 |
public class ElementModelImpl extends SchemaImpl implements ElementModel |
|
31 |
{ |
|
32 |
private String _elementName;
|
|
33 |
private List _attributeModels;
|
|
34 |
private List _shareableAttributeModels;
|
|
35 |
private List _rules;
|
|
36 |
private List _shareableRules;
|
|
37 |
private String _contentTranslator;
|
|
38 |
|
|
39 | 3957 |
public String getElementName()
|
40 |
{ |
|
41 | 3957 |
return _elementName;
|
42 |
} |
|
43 |
|
|
44 | 2195 |
public void setElementName(String string) |
45 |
{ |
|
46 | 2195 |
_elementName = string; |
47 |
} |
|
48 |
|
|
49 | 2687 |
public void addAttributeModel(AttributeModel attributeModel) |
50 |
{ |
|
51 | 2687 |
if (_attributeModels == null) |
52 | 1233 |
_attributeModels = new ArrayList();
|
53 |
|
|
54 | 2687 |
_attributeModels.add(attributeModel); |
55 | 2687 |
_shareableAttributeModels = null;
|
56 |
} |
|
57 |
|
|
58 | 4274 |
public List getAttributeModels()
|
59 |
{ |
|
60 | 4274 |
if (_shareableAttributeModels == null) |
61 | 1931 |
_shareableAttributeModels = |
62 | 1931 |
_attributeModels == null
|
63 |
? Collections.EMPTY_LIST |
|
64 |
: Collections.unmodifiableList(_attributeModels); |
|
65 |
|
|
66 | 4274 |
return _shareableAttributeModels;
|
67 |
} |
|
68 |
|
|
69 | 8341 |
public void addRule(Rule rule) |
70 |
{ |
|
71 | 8341 |
if (_rules == null) |
72 | 2192 |
_rules = new ArrayList();
|
73 |
|
|
74 | 8341 |
_rules.add(rule); |
75 | 8341 |
_shareableRules = null;
|
76 |
} |
|
77 |
|
|
78 | 3650 |
public List getRules()
|
79 |
{ |
|
80 | 3650 |
if (_shareableRules == null) |
81 | 479 |
_shareableRules = |
82 | 479 |
_rules == null ? Collections.EMPTY_LIST : Collections.unmodifiableList(_rules);
|
83 |
|
|
84 | 3650 |
return _shareableRules;
|
85 |
} |
|
86 |
|
|
87 | 10 |
public String getContentTranslator()
|
88 |
{ |
|
89 | 10 |
return _contentTranslator;
|
90 |
} |
|
91 |
|
|
92 | 2193 |
public void setContentTranslator(String string) |
93 |
{ |
|
94 | 2193 |
_contentTranslator = string; |
95 |
} |
|
96 |
|
|
97 |
} |
|
98 |
|
|