Skip to main content
summaryrefslogtreecommitdiffstats
blob: a2b5efa9a3a31c7b304d9361eb35d13129dd837e (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
/*******************************************************************************
 * Copyright (c) 2001, 2008 Oracle Corporation and others.
 * All rights reserved. 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:
 *     Oracle Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.jsf.core.internal.tld;

import org.eclipse.jst.jsf.common.dom.AttributeIdentifier;
import org.eclipse.jst.jsf.common.dom.TagIdentifier;

/**
 * A factory for creating instances of AttributeIdentifier. Some results may be
 * cached or otherwise based on shared instances.
 * 
 * @author cbateman
 * 
 */
public final class AttributeIdentifierFactory
{
    /**
     * @param tagId
     * @param attributeName
     * @return an attribute id based on the tagid and attribute name provided.
     */
    public static AttributeIdentifier createAttributeIdentifier(
            final TagIdentifier tagId, final String attributeName)
    {
        return new SimpleAttributeIdentifier(tagId, attributeName);
    }

    private final static class SimpleAttributeIdentifier extends
            AttributeIdentifier
    {
        private final TagIdentifier _tagId;
        private final String        _attributeName;

        public SimpleAttributeIdentifier(final TagIdentifier tagId,
                String attributeName)
        {
            _tagId = tagId;
            _attributeName = attributeName;
        }

        @Override
        public String getName()
        {
            return _attributeName;
        }

        @Override
        public TagIdentifier getTagIdentifier()
        {
            return _tagId;
        }
    }
}

Back to the top