Skip to main content
summaryrefslogtreecommitdiffstats
blob: 8bb29a82be4801c8a6db5c44ae807d61d230c605 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*******************************************************************************
 * Copyright (c) 2010, 2019 IBM Corporation and others.
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.jsf.facelet.core.internal.cm;

import java.util.Iterator;

import org.eclipse.wst.xml.core.internal.contentmodel.CMContent;
import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType;
import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;

class DocumentElementCMAdapter implements CMNamedNodeMap,
        CMElementDeclaration
{
    private final  String               _prefix;
    private final  ElementCMAdapter     _adapter;
    
    public DocumentElementCMAdapter(final ElementCMAdapter adapter, final String prefix)
    {
        _prefix = prefix;
        _adapter = adapter;
    }
    
    public int getLength()
    {
        return _adapter.getLength();
    }

    public CMNode getNamedItem(String name)
    {
        return _adapter.getNamedItem(name);
    }

    public CMNode item(int index)
    {
        return _adapter.item(index);
    }

    @SuppressWarnings("unchecked")
    public Iterator iterator()
    {
        return _adapter.iterator();
    }

    public CMNamedNodeMap getAttributes()
    {
        return _adapter.getAttributes();
    }

    public CMContent getContent()
    {
        return _adapter.getContent();
    }

    public int getContentType()
    {
       return _adapter.getContentType();
    }

    public CMDataType getDataType()
    {
        return _adapter.getDataType();
    }

    public String getElementName()
    {
        return getPrefixedName(_adapter.getElementName());
    }

    public CMNamedNodeMap getLocalElements()
    {
        return _adapter.getLocalElements();
    }

    public int getMaxOccur()
    {
        return _adapter.getMaxOccur();
    }

    public int getMinOccur()
    {
        return _adapter.getMinOccur();
    }

    public String getNodeName()
    {
        return getPrefixedName(_adapter.getNodeName());
    }

    private String getPrefixedName(final String name)
    {
        return _prefix + ":"+name; //$NON-NLS-1$
    }
    
    public int getNodeType()
    {
        return _adapter.getNodeType();
    }

    public Object getProperty(String propertyName)
    {
        return _adapter.getProperty(propertyName);
    }

    public boolean supports(String propertyName)
    {
        return _adapter.supports(propertyName);
    }

}

Back to the top