Class AbstractGISElement<C extends GISContainer<?>,T extends AbstractGISElement<C,T>>
- java.lang.Object
-
- org.arakhne.afc.gis.primitive.AbstractGISElement<C,T>
-
- Type Parameters:
C- is the type of the container of this element.T- is the type of this element, used by the cloning feature.
- All Implemented Interfaces:
Serializable,Cloneable,EventListener,AttributeChangeListener,AttributeCollection,AttributeProvider,GISCloneable<T>,GISElement,GISPrimitive,JsonableObject
- Direct Known Subclasses:
AbstractBoundedGISElement
public abstract class AbstractGISElement<C extends GISContainer<?>,T extends AbstractGISElement<C,T>> extends Object implements GISElement, AttributeChangeListener, GISCloneable<T>
Element of a GIS application.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:53
- Author:
- Stéphane GALLAND
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- giscore
-
-
Field Summary
Fields Modifier and Type Field Description (package private) AttributeCollectionattributeSourceSource of attributes.(package private) WeakReference<C>mapContainerthe layer that contains this element.-
Fields inherited from interface org.arakhne.afc.gis.primitive.GISElement
ATTR_NAME, NAME_COMPARATOR
-
Fields inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
COMPARATOR
-
-
Constructor Summary
Constructors Constructor Description AbstractGISElement(UUID id, AttributeCollection attributeSource)Create a GISElement with the specified attribute provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttributeChangeListener(AttributeChangeListener listener)Add a listener on the attribute value changes.voidaddAttributes(Map<String,Object> content)Put the values given as parameter in this attribute provider.voidaddAttributes(AttributeProvider content)Put the values given as parameter in this attribute provider.Iterable<Attribute>attributes()Replies all the attributes.Tclone()Clone this object to obtain a valid copy.intcopyAttributes(GISElement container)Copy all the attributes of the specified container.voidflush()Force this provider to synchronized the memory state of the attributes with a remote storage area.voidfreeMemory()Clean the internal memory-storage structures if they exist.Collection<String>getAllAttributeNames()Replies all the attribute names.Collection<Attribute>getAllAttributes()Replies all the attributes.Map<AttributeType,Collection<Attribute>>getAllAttributesByType()Replies all the attributes sorted by type.AttributeValuegetAttribute(String name)Replies the value for the given attribute.booleangetAttribute(String name, boolean defaultValue)Replies the value for the given attribute.doublegetAttribute(String name, double defaultValue)Replies the value for the given attribute.floatgetAttribute(String name, float defaultValue)Replies the value for the given attribute.intgetAttribute(String name, int defaultValue)Replies the value for the given attribute.longgetAttribute(String name, long defaultValue)Replies the value for the given attribute.<ET extends Enum<ET>>
ETgetAttribute(String name, ET defaultValue)Replies the value for the given attribute.Class<?>getAttribute(String name, Class<?> defaultValue)Replies the value for the given attribute.StringgetAttribute(String name, String defaultValue)Replies the value for the given attribute.InetAddressgetAttribute(String name, InetAddress defaultValue)Replies the value for the given attribute.InetAddressgetAttribute(String name, InetSocketAddress defaultValue)Replies the value for the given attribute.URIgetAttribute(String name, URI defaultValue)Replies the value for the given attribute.URLgetAttribute(String name, URL defaultValue)Replies the value for the given attribute.DategetAttribute(String name, Date defaultValue)Replies the value for the given attribute.UUIDgetAttribute(String name, UUID defaultValue)Replies the value for the given attribute.AttributeValuegetAttribute(String name, AttributeValue default_value)Replies the value for the given attribute.booleangetAttributeAsBool(String name)Replies the value for the given attribute.DategetAttributeAsDate(String name)Replies the value for the given attribute.doublegetAttributeAsDouble(String name)Replies the value for the given attribute.Enum<?>getAttributeAsEnumeration(String name)Replies the value for the given attribute.<ET extends Enum<ET>>
ETgetAttributeAsEnumeration(String name, Class<ET> type)Replies the value for the given attribute.floatgetAttributeAsFloat(String name)Replies the value for the given attribute.InetAddressgetAttributeAsInetAddress(String name)Replies the value for the given attribute.intgetAttributeAsInt(String name)Replies the value for the given attribute.Class<?>getAttributeAsJavaClass(String name)Replies the value for the given attribute.longgetAttributeAsLong(String name)Replies the value for the given attribute.StringgetAttributeAsString(String name)Replies the value for the given attribute.URIgetAttributeAsURI(String name)Replies the value for the given attribute.URLgetAttributeAsURL(String name)Replies the value for the given attribute.UUIDgetAttributeAsUUID(String name)Replies the value for the given attribute.AttributeCollectiongetAttributeCollection()Replies the attribute provider associated to this element.intgetAttributeCount()Replies the count of attributes.AttributegetAttributeObject(String name)Replies the attribute with the given name.AttributeProvidergetAttributeProvider()Replies the attribute container associated to this element.CgetContainer()Replies the object which contains this MapElement.GeoIdgetGeoId()Replies an unique identifier for primitive.StringgetName()Replies the name of the element.ObjectgetTopContainer()Replies the top-most object which contains this MapElement.UUIDgetUUID()Replies an unique identifier for element.booleanhasAttribute(String name)Replies if the given attribute exists.StringhashKey()Replies a string suitable for hashtables.booleanisEventFirable()Replies if the events are fired by this container.voidonAttributeChangeEvent(AttributeChangeEvent event)Invoked when the attribute's value changed.booleanremoveAllAttributes()Remove all the attributes.booleanremoveAttribute(String name)Remove the given attribute.voidremoveAttributeChangeListener(AttributeChangeListener listener)Remove a listener on the attribute value changes.booleanrenameAttribute(String oldname, String newname)Rename the attribute.booleanrenameAttribute(String oldname, String newname, boolean overwrite)Rename the attribute .AttributesetAttribute(String name, boolean value)Set the value for the given attribute.AttributesetAttribute(String name, double value)Set the value for the given attribute.AttributesetAttribute(String name, float value)Set the value for the given attribute.AttributesetAttribute(String name, int value)Set the value for the given attribute.AttributesetAttribute(String name, long value)Set the value for the given attribute.AttributesetAttribute(String name, Class<?> value)Set the value for the given attribute.AttributesetAttribute(String name, Enum<?> value)Set the value for the given attribute.AttributesetAttribute(String name, String value)Set the value for the given attribute.AttributesetAttribute(String name, InetAddress value)Set the value for the given attribute.AttributesetAttribute(String name, InetSocketAddress value)Set the value for the given attribute.AttributesetAttribute(String name, URI value)Set the value for the given attribute.AttributesetAttribute(String name, URL value)Set the value for the given attribute.AttributesetAttribute(String name, Date value)Set the value for the given attribute.AttributesetAttribute(String name, UUID value)Set the value for the given attribute.AttributesetAttribute(String name, AttributeValue value)Set the value for the given attribute.AttributesetAttribute(Attribute value)Set the value for the given attribute.voidsetAttributes(Map<String,Object> content)Set the content of this collection from the given map.voidsetAttributes(AttributeProvider content)Set the content of this collection from the given map.AttributesetAttributeType(String name, AttributeType type)Set the type of the attribute with the given name.booleansetContainer(C container)Sets the container of this MapElement.voidsetEventFirable(boolean isFirable)Set if the events are fired by this container.voidsetName(String name)Set the name of the element.protected voidsetUUID(UUID id)Set the unique identifier for element.voidtoJson(JsonBuffer buffer)Replies the Json representation of this node.Map<String,Object>toMap()Replies the map of the values stored in this attribute provider.voidtoMap(Map<String,Object> mapToFill)Fill the given map with the values stored in this attribute provider.StringtoString()-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
getGeoLocation
-
-
-
-
Field Detail
-
attributeSource
AttributeCollection attributeSource
Source of attributes.
-
mapContainer
transient WeakReference<C extends GISContainer<?>> mapContainer
the layer that contains this element.
-
-
Constructor Detail
-
AbstractGISElement
public AbstractGISElement(UUID id, AttributeCollection attributeSource)
Create a GISElement with the specified attribute provider.- Parameters:
id- is the unique identifier of this element, ornullif unknown.attributeSource- is the attribute provider to use. Ifnullwas specified the new GISElement will use a default attribute provider (most of the time anHeapAttributeCollection- Since:
- 4.0
-
-
Method Detail
-
isEventFirable
@Pure public boolean isEventFirable()
Description copied from interface:AttributeCollectionReplies if the events are fired by this container.- Specified by:
isEventFirablein interfaceAttributeCollection- Returns:
trueif the events are fired; otherwisefalseif events are not fired.
-
setEventFirable
public void setEventFirable(boolean isFirable)
Description copied from interface:AttributeCollectionSet if the events are fired by this container.- Specified by:
setEventFirablein interfaceAttributeCollection- Parameters:
isFirable- istrueif the events are fired; otherwisefalseif events are not fired.
-
clone
@Pure public T clone()
Clone this object to obtain a valid copy.- Specified by:
clonein interfaceAttributeCollection- Specified by:
clonein interfaceAttributeProvider- Specified by:
clonein interfaceGISCloneable<C extends GISContainer<?>>- Specified by:
clonein interfaceGISElement- Overrides:
clonein classObject- Returns:
- a copy
-
onAttributeChangeEvent
public void onAttributeChangeEvent(AttributeChangeEvent event)
Description copied from interface:AttributeChangeListenerInvoked when the attribute's value changed.- Specified by:
onAttributeChangeEventin interfaceAttributeChangeListener- Parameters:
event- describes the changes.
-
setContainer
public boolean setContainer(C container)
Sets the container of this MapElement.- Parameters:
container- the new container.- Returns:
- the success state of the operation.
-
getContainer
@Pure public C getContainer()
Replies the object which contains this MapElement.- Returns:
- the container or
null
-
getTopContainer
@Pure public Object getTopContainer()
Replies the top-most object which contains this MapElement.- Returns:
- the top container or
null
-
getAttributeCollection
@Pure public AttributeCollection getAttributeCollection()
Replies the attribute provider associated to this element.- Returns:
- the attribute provider
-
getAttributeProvider
@Pure public AttributeProvider getAttributeProvider()
Replies the attribute container associated to this element.- Returns:
- the attribute container
-
getGeoId
@Pure public final GeoId getGeoId()
Description copied from interface:GISPrimitiveReplies an unique identifier for primitive.A Geo-Id is unique according to the geo-location of the element. If two elements have the same points in the same order, or if two elements have the same points in a reverse order, they must have the same Geo-Id.
- Specified by:
getGeoIdin interfaceGISPrimitive- Returns:
- an identifier
- See Also:
GISPrimitive.getGeoLocation()
-
getUUID
@Pure public UUID getUUID()
Replies an unique identifier for element.A Unique IDentifier (UID) must be unique for all the object instances.
The following code is always true (where the arguments of the constructors are the list of points of the polyline). It illustrates that for two elements with the same geo-localized points, they have the same geo-location identifier (Geo-Id) and they have different unique ientifier (Uid):
GISElement obj1 = new MapPolyline(100,10,200,30,300,4); GISElement obj2 = new MapPolyline(100,10,200,30,300,4); assert( obj1.getGeoId().equals(obj2.getGeoId()) ); assert( obj2.getGeoId().equals(obj1.getGeoId()) ); assert( ! obj1.getUid().equals(obj2.getUid()) ); assert( ! obj2.getUid().equals(obj1.getUid()) );- Specified by:
getUUIDin interfaceGISPrimitive- Returns:
- an identifier
- Since:
- 4.0
-
setUUID
protected void setUUID(UUID id)
Set the unique identifier for element.A Unique IDentifier (UID) must be unique for all the object instances.
- Parameters:
id- is the new identifier- Since:
- 4.0
-
addAttributeChangeListener
public void addAttributeChangeListener(AttributeChangeListener listener)
Description copied from interface:AttributeCollectionAdd a listener on the attribute value changes.- Specified by:
addAttributeChangeListenerin interfaceAttributeCollection- Parameters:
listener- the listener.
-
removeAttributeChangeListener
public void removeAttributeChangeListener(AttributeChangeListener listener)
Description copied from interface:AttributeCollectionRemove a listener on the attribute value changes.- Specified by:
removeAttributeChangeListenerin interfaceAttributeCollection- Parameters:
listener- the listener.
-
copyAttributes
public int copyAttributes(GISElement container)
Description copied from interface:GISElementCopy all the attributes of the specified container.- Specified by:
copyAttributesin interfaceGISElement- Parameters:
container- is the object from which the attributes must be extracted.- Returns:
- count of copied attributes
-
getName
@Pure public String getName()
Description copied from interface:GISElementReplies the name of the element.- Specified by:
getNamein interfaceGISElement- Returns:
- the name
-
setName
public void setName(String name)
Description copied from interface:GISElementSet the name of the element.- Specified by:
setNamein interfaceGISElement- Parameters:
name- the new name.
-
getAttributeCount
@Pure public int getAttributeCount()
Description copied from interface:AttributeProviderReplies the count of attributes.- Specified by:
getAttributeCountin interfaceAttributeProvider- Returns:
- the count of attributes.
-
hasAttribute
@Pure public boolean hasAttribute(String name)
Description copied from interface:AttributeProviderReplies if the given attribute exists.- Specified by:
hasAttributein interfaceAttributeProvider- Parameters:
name- the name.- Returns:
trueis an attribute with the given name exists, otherwisefalse
-
getAllAttributes
@Pure public Collection<Attribute> getAllAttributes()
Description copied from interface:AttributeProviderReplies all the attributes.- Specified by:
getAllAttributesin interfaceAttributeProvider- Returns:
- the list of all attributes
-
attributes
@Pure public Iterable<Attribute> attributes()
Description copied from interface:AttributeProviderReplies all the attributes.- Specified by:
attributesin interfaceAttributeProvider- Returns:
- an iterable object that contains the attributes.
-
getAllAttributesByType
@Pure public Map<AttributeType,Collection<Attribute>> getAllAttributesByType()
Description copied from interface:AttributeProviderReplies all the attributes sorted by type.The keys of the returned hashtable are the types and the values are array of attributes (
Vector).- Specified by:
getAllAttributesByTypein interfaceAttributeProvider- Returns:
- the attributes grouped by type.
-
getAllAttributeNames
@Pure public Collection<String> getAllAttributeNames()
Description copied from interface:AttributeProviderReplies all the attribute names. This function never load the attribute values even if they are not inside the storage layer.- Specified by:
getAllAttributeNamesin interfaceAttributeProvider- Returns:
- the list of all attribute names.
-
getAttribute
@Pure public AttributeValue getAttribute(String name)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value or
null
-
getAttribute
@Pure public boolean getAttribute(String name, boolean defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public int getAttribute(String name, int defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public long getAttribute(String name, long defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public float getAttribute(String name, float defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public double getAttribute(String name, double defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public String getAttribute(String name, String defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public UUID getAttribute(String name, UUID defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public URL getAttribute(String name, URL defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public URI getAttribute(String name, URI defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public Date getAttribute(String name, Date defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public InetAddress getAttribute(String name, InetAddress defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public InetAddress getAttribute(String name, InetSocketAddress defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public <ET extends Enum<ET>> ET getAttribute(String name, ET defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Type Parameters:
ET- is the type of the enumeration.- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public Class<?> getAttribute(String name, Class<?> defaultValue)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.defaultValue- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public AttributeValue getAttribute(String name, AttributeValue default_value)
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributein interfaceAttributeProvider- Parameters:
name- the name.default_value- is the default value replied if the attribute has no value.- Returns:
- the value or
null
-
getAttributeObject
@Pure public Attribute getAttributeObject(String name)
Description copied from interface:AttributeProviderReplies the attribute with the given name.- Specified by:
getAttributeObjectin interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the attribute or
null
-
getAttributeAsBool
@Pure public boolean getAttributeAsBool(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsBoolin interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsInt
@Pure public int getAttributeAsInt(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsIntin interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsLong
@Pure public long getAttributeAsLong(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsLongin interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsFloat
@Pure public float getAttributeAsFloat(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsFloatin interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsDouble
@Pure public double getAttributeAsDouble(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsDoublein interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsString
@Pure public String getAttributeAsString(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsStringin interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsUUID
@Pure public UUID getAttributeAsUUID(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsUUIDin interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsURL
@Pure public URL getAttributeAsURL(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsURLin interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsURI
@Pure public URI getAttributeAsURI(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsURIin interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsDate
@Pure public Date getAttributeAsDate(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsDatein interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsInetAddress
@Pure public InetAddress getAttributeAsInetAddress(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsInetAddressin interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsEnumeration
@Pure public <ET extends Enum<ET>> ET getAttributeAsEnumeration(String name, Class<ET> type) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsEnumerationin interfaceAttributeProvider- Type Parameters:
ET- is the type of the enumeration to retreive.- Parameters:
name- the name.type- is the type of the enumeration to retreive.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsEnumeration
@Pure public Enum<?> getAttributeAsEnumeration(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsEnumerationin interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
getAttributeAsJavaClass
@Pure public Class<?> getAttributeAsJavaClass(String name) throws AttributeException
Description copied from interface:AttributeProviderReplies the value for the given attribute.- Specified by:
getAttributeAsJavaClassin interfaceAttributeProvider- Parameters:
name- the name.- Returns:
- the value
- Throws:
AttributeException- if the attribute was never set.
-
setAttribute
public Attribute setAttribute(String name, AttributeValue value) throws AttributeException
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null - Throws:
AttributeException- on error.
-
setAttribute
public Attribute setAttribute(String name, boolean value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, int value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, long value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, float value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, double value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, String value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, UUID value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, URL value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, URI value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, Date value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, InetAddress value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, InetSocketAddress value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, Enum<?> value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, Class<?> value)
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to set.value- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(Attribute value) throws AttributeException
Description copied from interface:AttributeCollectionSet the value for the given attribute.- Specified by:
setAttributein interfaceAttributeCollection- Parameters:
value- is the value to store.- Returns:
- the changed attribute or
null - Throws:
AttributeException- on error.
-
setAttributeType
public Attribute setAttributeType(String name, AttributeType type) throws AttributeException
Description copied from interface:AttributeCollectionSet the type of the attribute with the given name.- Specified by:
setAttributeTypein interfaceAttributeCollection- Parameters:
name- is the name of the attributetype- is the desired type.- Returns:
- the changed attribute or
null - Throws:
AttributeException- on error.
-
removeAttribute
public boolean removeAttribute(String name)
Description copied from interface:AttributeCollectionRemove the given attribute.- Specified by:
removeAttributein interfaceAttributeCollection- Parameters:
name- is the name of the attribute to remove.- Returns:
trueon success, otherwhisefalse
-
removeAllAttributes
public boolean removeAllAttributes()
Description copied from interface:AttributeCollectionRemove all the attributes.- Specified by:
removeAllAttributesin interfaceAttributeCollection- Returns:
falseif something wrong appends
-
renameAttribute
public final boolean renameAttribute(String oldname, String newname)
Description copied from interface:AttributeCollectionRename the attribute.If a attribute named
newnamealready exists, this function will replyfalse.This function is equivalent to
renameAttribute(oldname, newname, false).- Specified by:
renameAttributein interfaceAttributeCollection- Parameters:
oldname- is the name of the attribute to rename.newname- is the new name of the attribute.- Returns:
falseif something wrong appends
-
renameAttribute
public boolean renameAttribute(String oldname, String newname, boolean overwrite)
Description copied from interface:AttributeCollectionRename the attribute .- Specified by:
renameAttributein interfaceAttributeCollection- Parameters:
oldname- is the name of the attribute to rename.newname- is the new name of the attribute.overwrite- must betrueif the value of an existing attribute named bynewnamemust be overwritten by the value of the attribute namedoldname.- Returns:
falseif something wrong appends
-
freeMemory
public void freeMemory()
Description copied from interface:AttributeProviderClean the internal memory-storage structures if they exist.This function permits to limit the memory usage without removing the attribute value from a hard storage area (database, files...). The attribute which are freed by this method could be reloaded in memory with a call to a getting method.
- Specified by:
freeMemoryin interfaceAttributeProvider
-
setAttributes
public void setAttributes(Map<String,Object> content)
Description copied from interface:AttributeCollectionSet the content of this collection from the given map. Any previous content of this attribute collection will be lost. This function is equivalent to:this.removeAllAttributes(); this.addAttributes(content);- Specified by:
setAttributesin interfaceAttributeCollection- Parameters:
content- is the content.- See Also:
AttributeCollection.addAttributes(Map)
-
setAttributes
public void setAttributes(AttributeProvider content) throws AttributeException
Description copied from interface:AttributeCollectionSet the content of this collection from the given map. Any previous content of this attribute collection will be lost. This function is equivalent to:this.removeAllAttributes(); this.addAttributes(content);- Specified by:
setAttributesin interfaceAttributeCollection- Parameters:
content- is the content.- Throws:
AttributeException- if one attribute from the content cannot be inserted.- See Also:
AttributeCollection.addAttributes(AttributeProvider)
-
addAttributes
public void addAttributes(Map<String,Object> content)
Description copied from interface:AttributeCollectionPut the values given as parameter in this attribute provider. Any previous content of this attribute collection will remain if the keys are not inside the given content. If the values from the given content will be used to overwrite any existing value.- Specified by:
addAttributesin interfaceAttributeCollection- Parameters:
content- is the content to add inside.- See Also:
AttributeCollection.setAttributes(Map)
-
addAttributes
public void addAttributes(AttributeProvider content) throws AttributeException
Description copied from interface:AttributeCollectionPut the values given as parameter in this attribute provider. Any previous content of this attribute collection will remain if the keys are not inside the given content. If the values from the given content will be used to overwrite any existing value.- Specified by:
addAttributesin interfaceAttributeCollection- Parameters:
content- is the content to add inside.- Throws:
AttributeException- if one attribute from the content cannot be inserted.- See Also:
AttributeCollection.addAttributes(AttributeProvider)
-
flush
public void flush()
Description copied from interface:AttributeCollectionForce this provider to synchronized the memory state of the attributes with a remote storage area.- Specified by:
flushin interfaceAttributeCollection
-
toMap
@Pure public Map<String,Object> toMap()
Description copied from interface:AttributeProviderReplies the map of the values stored in this attribute provider. The replied map is a copy of or an unmodifiable version of the internal map, if it exists.q- Specified by:
toMapin interfaceAttributeProvider- Returns:
- the map, never
null.
-
toMap
public void toMap(Map<String,Object> mapToFill)
Description copied from interface:AttributeProviderFill the given map with the values stored in this attribute provider.- Specified by:
toMapin interfaceAttributeProvider- Parameters:
mapToFill- is the map to fill, nevernull.
-
hashKey
@Pure public String hashKey()
Description copied from interface:GISElementReplies a string suitable for hashtables.- Specified by:
hashKeyin interfaceGISElement- Returns:
- a string suitable for hashtables.
-
toJson
@Pure public void toJson(JsonBuffer buffer)
Description copied from interface:JsonableObjectReplies the Json representation of this node.- Specified by:
toJsonin interfaceJsonableObject- Parameters:
buffer- the Json buffer.
-
-