1 |
package skrueger.geotools; |
package skrueger.geotools; |
2 |
|
|
3 |
import java.util.ArrayList; |
import java.util.ArrayList; |
4 |
|
import java.util.Collection; |
5 |
import java.util.Collections; |
import java.util.Collections; |
6 |
import java.util.List; |
import java.util.List; |
7 |
import java.util.Map; |
import java.util.Map; |
11 |
import org.geotools.feature.NameImpl; |
import org.geotools.feature.NameImpl; |
12 |
import org.opengis.feature.type.Name; |
import org.opengis.feature.type.Name; |
13 |
|
|
14 |
import skrueger.AbstractAttributeMetadata; |
import skrueger.AttributeMetadataInterface; |
|
import skrueger.AttributeMetadata; |
|
15 |
import skrueger.QualityQuantizable; |
import skrueger.QualityQuantizable; |
16 |
import skrueger.i8n.Translation; |
import skrueger.i8n.Translation; |
17 |
|
|
22 |
* The {@link #get(Name)} and {@link #get(String)} methods will never return |
* The {@link #get(Name)} and {@link #get(String)} methods will never return |
23 |
* <code>null</code>, but rather create a default {@link AMD_IMPL} on-the-fly. |
* <code>null</code>, but rather create a default {@link AMD_IMPL} on-the-fly. |
24 |
*/ |
*/ |
25 |
public abstract class AttributeMetadataMap<AMD_IMPL extends AttributeMetadata> |
public abstract class AttributeMetadataMap<AMD_IMPL extends AttributeMetadataInterface> |
26 |
extends TreeMap<Name, AMD_IMPL> implements |
extends TreeMap<Name, AMD_IMPL> implements |
27 |
Copyable<AttributeMetadataMap>, QualityQuantizable { |
Copyable<AttributeMetadataMap>, QualityQuantizable { |
28 |
|
|
71 |
* {@link Copyable} interface. |
* {@link Copyable} interface. |
72 |
*/ |
*/ |
73 |
@Override |
@Override |
74 |
public AttributeMetadataMap<? extends AttributeMetadata> copyTo(AttributeMetadataMap amdMap) { |
public AttributeMetadataMap<? extends AttributeMetadataInterface> copyTo(AttributeMetadataMap amdMap) { |
75 |
|
|
76 |
amdMap.clear(); |
amdMap.clear(); |
77 |
|
|
83 |
} |
} |
84 |
|
|
85 |
/** |
/** |
86 |
* Returns the {@link AMD_IMPL} for a given {@link Name}. May return |
* Returns the {@link AMD_IMPL} for a given {@link NameImpl}. May return |
87 |
* <code>null</code> or create a default {@link AttributeMetadata} depending |
* <code>null</code> or create a default {@link AttributeMetadataInterface} depending |
88 |
* on whether this method is overwritten. fly. |
* on whether this method is overwritten. fly. |
89 |
*/ |
*/ |
90 |
public AMD_IMPL get(final Name name) { |
public AMD_IMPL get(final Name name) { |
94 |
/** |
/** |
95 |
* @Deprecated use get(Name name) or get(String localName) |
* @Deprecated use get(Name name) or get(String localName) |
96 |
*/ |
*/ |
97 |
|
@Deprecated |
98 |
@Override |
@Override |
|
@Deprecated |
|
99 |
public AMD_IMPL get(final Object key) { |
public AMD_IMPL get(final Object key) { |
100 |
LOGGER.error("PLEASE DONT USE get(Object) any MORE!"); |
LOGGER.error("PLEASE DONT USE get(Object) any MORE!"); |
101 |
return super.get(key); |
return super.get(key); |
144 |
* (heavier => further down) |
* (heavier => further down) |
145 |
*/ |
*/ |
146 |
public List<AMD_IMPL> sortedValues() { |
public List<AMD_IMPL> sortedValues() { |
147 |
final ArrayList<AMD_IMPL> list = new ArrayList<AMD_IMPL>(); |
final List<AMD_IMPL> list = new ArrayList<AMD_IMPL>(); |
148 |
list.addAll(values()); |
final Collection<AMD_IMPL> values = values(); |
149 |
|
list.addAll(values); |
150 |
Collections.sort(list); |
Collections.sort(list); |
151 |
return list; |
return list; |
152 |
} |
} |
163 |
} |
} |
164 |
return list; |
return list; |
165 |
} |
} |
166 |
|
|
167 |
|
/** |
168 |
|
* Just for debuggung. Simply returns {@code super.put(.)}. |
169 |
|
* TODO: remove this method. |
170 |
|
*/ |
171 |
|
@Override |
172 |
|
public AMD_IMPL put(Name key, AMD_IMPL value) { |
173 |
|
return super.put(key, value); |
174 |
|
}; |
175 |
|
|
176 |
} |
} |