Package org.apache.sis.xml
Interface NilObject
-
public interface NilObjectA marker interface for nil XML elements providing an explanation about why the information is absent. GeoAPI getter methods usually return anullvalue when no information is available for a given attribute. However it is possible to specify why an information is absent, in which case the corresponding getter method will rather return an instance of thisNilObjectinterface. The information may be absent for various reasons, including the attribute being inapplicable in the metadata context (NilReason.INAPPLICABLE), the information probably exists but is unknown to the data provider (UNKNOW), the information may not exist at all (MISSING) or can not be divulged (WITHHELD).Nil objects appear most frequently in XML documents because if a mandatory ISO 19115-1 attribute is absent, then the ISO 19115-3 standard requires us to said why it is absent. The following example shows a
CI_Citationfragment with an ordinaryCI_Serieselement on the left side, and an unknownCI_Serieselement on the right side:
If theExample of missing object Normal SerieselementUnknown Serieselement<cit:CI_Citation> <cit:series> <cit:CI_Series> <!-- Some content here --> </cit:CI_Series> </cit:series> </cit:CI_Citation><cit:CI_Citation> <cit:series nilReason="unknown"/> </cit:CI_Citation>
CI_Serieselement was completely omitted, thenCitation.getSeries()method would returnnullin Apache SIS implementation. But since anilReasonis provided, then the SIS implementation ofgetSeries()will rather return an object which implement both theSeriesand theNilObjectinterfaces, and thegetNilReason()method on that instance will return theNilReason.UNKNOWNconstant.InstantiationInstances ofNilObjectare created by first fetching the reason why the information is missing, then invokingNilReason.createNilObject(Class). The following example instantiates aCitationobject which is nil because the information are missing:Citation nil = NilReason.MISSING.createNilObject(Citation.class);
- Since:
- 0.3
- See Also:
NilReason.createNilObject(Class),Numbers.valueOfNil(Class)
Defined in the
sis-metadatamodule
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description NilReasongetNilReason()Returns the reason why this object contains no information.
-
-
-
Method Detail
-
getNilReason
NilReason getNilReason()
Returns the reason why this object contains no information.- Returns:
- the reason why this object contains no information.
- See Also:
NilReason.forObject(Object)
-
-