public class TLcdFeatureMetaDataProvider extends Object
TLcdFeatureMetaDataProvider
is used by the GeoJson encoder to retrieve object
specific encoding meta information. This class provides a default implementation (see the
method documentation) which can be overridden as needed.Constructor and Description |
---|
TLcdFeatureMetaDataProvider() |
Modifier and Type | Method and Description |
---|---|
Map<String,String> |
getForeignMembers(Object aObject)
Returns the foreign members to be encoded for the given
domain object.
|
Object |
getId(Object aDomainObject)
Returns the id of
aDomainObject . |
String |
getIdPropertyName(Object aObject)
Returns the name of the property that holds the ID of the object that is being encoded.
|
Set<String> |
getPropertyNames(Object aDomainObject)
Returns the names of the properties of an object that must be included in the GeoJSON Feature's
property object. |
Object |
getPropertyValue(Object aDomainObject,
String aPropertyName)
This method is used by the
TLcdGeoJsonModelEncoder to retrieve the property values
of the objects that are being encoded. |
public String getIdPropertyName(Object aObject)
id
property.
Note that GeoJSON usually assumes the ID to be a string or integer. If you return null
,
the GeoJSON Feature will be encoded without an id
property.aObject
- The object from which the ID must be determined.public Map<String,String> getForeignMembers(Object aObject)
null
is returned.aObject
- The object for which foreign members are retrievednull
if there are none.public Set<String> getPropertyNames(Object aDomainObject)
property
object. All properties except the ID property (See
getIdPropertyName(Object)
are returned. Override this method if other behavior is required.aDomainObject
- The object for which the properties names must be determinedSet
of property names that must be included in the GeoJson encoded feature. If
no properties must be included, an empty array must be returned.public Object getPropertyValue(Object aDomainObject, String aPropertyName)
TLcdGeoJsonModelEncoder
to retrieve the property values
of the objects that are being encoded. By default, the object is assumed to
be an instance of (@link ILcdDataObject). The property name must exist in the object's
TLcdDataType
.If you want to use another domain model, you must override this method.aDomainObject
- The object for which the property value must be retrievedaPropertyName
- The name of the property whose value is to be retrieved.IllegalArgumentException
- if the property cannot be retrieved from the aDomainObjectpublic Object getId(Object aDomainObject)
aDomainObject
.
This is the method that is called by the TLcdGeoJsonModelEncoder
to obtain the id of the
domain object.
The default implementation of this method delegates to getIdPropertyName(Object)
and getPropertyValue(Object, String)
.aDomainObject
- The domain objectnull
in case the domain object has no id.