1 |
package skrueger.geotools; |
2 |
|
3 |
import java.util.List; |
4 |
|
5 |
import org.opengis.feature.type.Name; |
6 |
|
7 |
import skrueger.AttributeMetadataImpl; |
8 |
|
9 |
public class AttributeMetadataImplMap extends AttributeMetadataMap<AttributeMetadataImpl> { |
10 |
|
11 |
private static final long serialVersionUID = 6781939984242527498L; |
12 |
|
13 |
|
14 |
public AttributeMetadataImplMap(List<String> langs) { |
15 |
super(langs); |
16 |
} |
17 |
|
18 |
public AttributeMetadataImplMap() { |
19 |
super(); |
20 |
} |
21 |
|
22 |
/** |
23 |
* Returns a deep-copy. @see {@link Copyable} interface |
24 |
*/ |
25 |
@Override |
26 |
public AttributeMetadataImplMap copy() { |
27 |
final AttributeMetadataImplMap copy = new AttributeMetadataImplMap(langs); |
28 |
return (AttributeMetadataImplMap) copyTo(copy); |
29 |
} |
30 |
|
31 |
|
32 |
/** |
33 |
* Returns the {@link AttributeMetadataImpl} for a given {@link Name}. Never returns |
34 |
* <code>null</code>, but rather creates a default {@link AttributeMetadataImpl} on the |
35 |
* fly. |
36 |
*/ |
37 |
@Override |
38 |
public AttributeMetadataImpl get(final Name name) { |
39 |
final AttributeMetadataImpl AttributeMetadataImpl = super.get(name); |
40 |
if (AttributeMetadataImpl == null && name != null |
41 |
&& !name.getLocalPart().trim().isEmpty()) { |
42 |
|
43 |
put(name, new AttributeMetadataImpl(name, langs)); |
44 |
|
45 |
return super.get(name); |
46 |
} |
47 |
return AttributeMetadataImpl; |
48 |
} |
49 |
|
50 |
|
51 |
} |