| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
package org.apache.tapestry5.internal.parser; |
| 16 | |
|
| 17 | |
import org.apache.tapestry5.ioc.Location; |
| 18 | |
import org.apache.tapestry5.ioc.Resource; |
| 19 | |
import org.apache.tapestry5.ioc.internal.util.CollectionFactory; |
| 20 | |
import static org.apache.tapestry5.ioc.internal.util.CollectionFactory.newList; |
| 21 | |
import org.apache.tapestry5.ioc.internal.util.InternalUtils; |
| 22 | |
|
| 23 | |
import java.util.List; |
| 24 | |
import java.util.Map; |
| 25 | |
|
| 26 | |
public class ComponentTemplateImpl implements ComponentTemplate |
| 27 | |
{ |
| 28 | |
private final Resource resource; |
| 29 | |
|
| 30 | |
private final List<TemplateToken> tokens; |
| 31 | |
|
| 32 | |
private final Map<String, Location> componentIds; |
| 33 | |
|
| 34 | |
private final boolean extension; |
| 35 | |
|
| 36 | |
private final Map<String, List<TemplateToken>> overrides; |
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
public ComponentTemplateImpl(Resource resource, List<TemplateToken> tokens, |
| 46 | |
Map<String, Location> componentIds, boolean extension, |
| 47 | |
Map<String, List<TemplateToken>> overrides) |
| 48 | 524 | { |
| 49 | 524 | this.resource = resource; |
| 50 | 524 | this.extension = extension; |
| 51 | 524 | this.overrides = overrides; |
| 52 | 524 | this.tokens = newList(tokens); |
| 53 | 524 | this.componentIds = CollectionFactory.newMap(componentIds); |
| 54 | 524 | } |
| 55 | |
|
| 56 | |
public Resource getResource() |
| 57 | |
{ |
| 58 | 470 | return resource; |
| 59 | |
} |
| 60 | |
|
| 61 | |
public List<TemplateToken> getTokens() |
| 62 | |
{ |
| 63 | 552 | return tokens; |
| 64 | |
} |
| 65 | |
|
| 66 | |
public Map<String, Location> getComponentIds() |
| 67 | |
{ |
| 68 | 474 | return componentIds; |
| 69 | |
} |
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
|
| 74 | |
public boolean isMissing() |
| 75 | |
{ |
| 76 | 464 | return false; |
| 77 | |
} |
| 78 | |
|
| 79 | |
public List<TemplateToken> getExtensionPointTokens(String extensionPointId) |
| 80 | |
{ |
| 81 | 14 | return InternalUtils.get(overrides, extensionPointId); |
| 82 | |
} |
| 83 | |
|
| 84 | |
public boolean isExtension() |
| 85 | |
{ |
| 86 | 474 | return extension; |
| 87 | |
} |
| 88 | |
} |