001/*
002 *    GeoAPI - Java interfaces for OGC/ISO standards
003 *    Copyright © 2018-2023 Open Geospatial Consortium, Inc.
004 *    http://www.geoapi.org
005 *
006 *    Licensed under the Apache License, Version 2.0 (the "License");
007 *    you may not use this file except in compliance with the License.
008 *    You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *    Unless required by applicable law or agreed to in writing, software
013 *    distributed under the License is distributed on an "AS IS" BASIS,
014 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 *    See the License for the specific language governing permissions and
016 *    limitations under the License.
017 */
018package org.opengis.geoapi;
019
020import java.lang.reflect.Type;
021import java.lang.reflect.Field;
022import java.lang.reflect.Method;
023import java.lang.reflect.ParameterizedType;
024import java.lang.reflect.WildcardType;
025
026
027/**
028 * All interfaces, code lists, enumerations and exceptions declared in GeoAPI.
029 * The array of types that are members of a category is given by {@link #types()}.
030 *
031 * @author  Martin Desruisseaux (Geomatys)
032 * @version 3.1
033 * @since   3.1
034 */
035public enum Content {
036    /**
037     * All GeoAPI interfaces, in approximate dependency order.
038     * It is not possible to list the interfaces in strict dependency order because of circular dependencies.
039     * But this list nevertheless tries to provide such order in a "best effort" basis.
040     */
041    @SuppressWarnings("deprecation")
042    INTERFACES(org.opengis.util                    .InternationalString                 .class,
043               org.opengis.util                    .ControlledVocabulary                .class,
044               org.opengis.util                    .NameSpace                           .class,
045               org.opengis.util                    .GenericName                         .class,
046               org.opengis.util                    .LocalName                           .class,
047               org.opengis.util                    .ScopedName                          .class,
048               org.opengis.util                    .TypeName                            .class,
049               org.opengis.util                    .Type                                .class,
050               org.opengis.util                    .MemberName                          .class,
051               org.opengis.util                    .RecordSchema                        .class,
052               org.opengis.util                    .RecordType                          .class,
053               org.opengis.util                    .Record                              .class,
054               org.opengis.temporal                .TemporalPrimitive                   .class,
055               org.opengis.temporal                .Instant                             .class,
056               org.opengis.temporal                .Period                              .class,
057               org.opengis.metadata.citation       .Series                              .class,
058               org.opengis.metadata.citation       .Address                             .class,
059               org.opengis.metadata.citation       .Telephone                           .class,
060               org.opengis.metadata.citation       .OnlineResource                      .class,
061               org.opengis.metadata.citation       .Contact                             .class,
062               org.opengis.metadata.citation       .Party                               .class,
063               org.opengis.metadata.citation       .Responsibility                      .class,
064               org.opengis.metadata.citation       .ResponsibleParty                    .class,
065               org.opengis.metadata.citation       .Individual                          .class,
066               org.opengis.metadata.citation       .Organisation                        .class,
067               org.opengis.metadata.citation       .CitationDate                        .class,
068               org.opengis.metadata.citation       .Citation                            .class,
069               org.opengis.metadata                .Identifier                          .class,     // Depends on Citation
070               org.opengis.metadata.extent         .GeographicExtent                    .class,
071               org.opengis.metadata.extent         .GeographicBoundingBox               .class,
072               org.opengis.metadata.extent         .GeographicDescription               .class,     // Depends on Identifier
073               org.opengis.metadata.extent         .BoundingPolygon                     .class,
074               org.opengis.metadata.extent         .VerticalExtent                      .class,
075               org.opengis.metadata.extent         .TemporalExtent                      .class,
076               org.opengis.metadata.extent         .SpatialTemporalExtent               .class,
077               org.opengis.metadata.extent         .Extent                              .class,
078               org.opengis.referencing             .ReferenceIdentifier                 .class,
079               org.opengis.referencing             .ObjectDomain                        .class,     // Depends on Extent
080               org.opengis.referencing             .IdentifiedObject                    .class,     // A parameter dependency.
081               org.opengis.parameter               .GeneralParameterDescriptor          .class,
082               org.opengis.parameter               .GeneralParameterValue               .class,
083               org.opengis.parameter               .ParameterDescriptor                 .class,
084               org.opengis.parameter               .ParameterValue                      .class,
085               org.opengis.parameter               .ParameterDescriptorGroup            .class,
086               org.opengis.parameter               .ParameterValueGroup                 .class,
087               org.opengis.metadata.maintenance    .ScopeDescription                    .class,
088               org.opengis.metadata.maintenance    .Scope                               .class,
089               org.opengis.metadata.maintenance    .MaintenanceInformation              .class,
090               org.opengis.metadata.distribution   .Medium                              .class,
091               org.opengis.metadata.distribution   .Format                              .class,
092               org.opengis.metadata.distribution   .DataFile                            .class,
093               org.opengis.metadata.distribution   .DigitalTransferOptions              .class,
094               org.opengis.metadata.distribution   .StandardOrderProcess                .class,
095               org.opengis.metadata.distribution   .Distributor                         .class,
096               org.opengis.metadata.distribution   .Distribution                        .class,
097               org.opengis.metadata.constraint     .Releasability                       .class,
098               org.opengis.metadata.constraint     .Constraints                         .class,
099               org.opengis.metadata.constraint     .LegalConstraints                    .class,
100               org.opengis.metadata.constraint     .SecurityConstraints                 .class,
101               org.opengis.metadata.identification .BrowseGraphic                       .class,
102               org.opengis.metadata.identification .KeywordClass                        .class,
103               org.opengis.metadata.identification .Keywords                            .class,
104               org.opengis.metadata.identification .Usage                               .class,
105               org.opengis.metadata.identification .RepresentativeFraction              .class,
106               org.opengis.metadata.identification .Resolution                          .class,
107               org.opengis.metadata.identification .AssociatedResource                  .class,
108               org.opengis.metadata.identification .AggregateInformation                .class,
109               org.opengis.metadata.identification .Identification                      .class,
110               org.opengis.metadata.identification .DataIdentification                  .class,
111               org.opengis.metadata.identification .OperationMetadata                   .class,
112               org.opengis.metadata.identification .OperationChainMetadata              .class,
113               org.opengis.metadata.identification .CoupledResource                     .class,
114               org.opengis.metadata.identification .ServiceIdentification               .class,
115               org.opengis.referencing             .ReferenceSystem                     .class,     // Depends on Extent.
116               org.opengis.referencing.datum       .Datum                               .class,
117               org.opengis.referencing.datum       .DatumEnsemble                       .class,
118               org.opengis.referencing.cs          .CoordinateSystemAxis                .class,
119               org.opengis.referencing.cs          .CoordinateSystem                    .class,
120               org.opengis.referencing.crs         .CoordinateReferenceSystem           .class,
121               org.opengis.geometry.coordinate     .Position                            .class,
122               org.opengis.geometry                .DirectPosition                      .class,
123               org.opengis.geometry                .Envelope                            .class,
124               org.opengis.geometry                .Geometry                            .class,
125               org.opengis.coordinate              .CoordinateMetadata                  .class,
126               org.opengis.coordinate              .CoordinateSet                       .class,
127               org.opengis.geometry.primitive      .Point                               .class,
128               org.opengis.metadata.acquisition    .Instrument                          .class,
129               org.opengis.metadata.acquisition    .Platform                            .class,
130               org.opengis.metadata.acquisition    .PlatformPass                        .class,
131               org.opengis.metadata.acquisition    .Event                               .class,
132               org.opengis.metadata.acquisition    .EnvironmentalRecord                 .class,
133               org.opengis.metadata.acquisition    .Objective                           .class,
134               org.opengis.metadata.acquisition    .Operation                           .class,
135               org.opengis.metadata.acquisition    .RequestedDate                       .class,
136               org.opengis.metadata.acquisition    .Requirement                         .class,
137               org.opengis.metadata.acquisition    .Plan                                .class,
138               org.opengis.metadata.acquisition    .AcquisitionInformation              .class,
139               org.opengis.metadata.content        .RangeElementDescription             .class,
140               org.opengis.metadata.content        .RangeDimension                      .class,
141               org.opengis.metadata.content        .AttributeGroup                      .class,
142               org.opengis.metadata.content        .SampleDimension                     .class,
143               org.opengis.metadata.content        .Band                                .class,
144               org.opengis.metadata.content        .ContentInformation                  .class,
145               org.opengis.metadata.content        .CoverageDescription                 .class,
146               org.opengis.metadata.content        .ImageDescription                    .class,
147               org.opengis.metadata.content        .FeatureTypeInfo                     .class,
148               org.opengis.metadata.content        .FeatureCatalogueDescription         .class,
149               org.opengis.metadata.lineage        .NominalResolution                   .class,
150               org.opengis.metadata.lineage        .Source                              .class,
151               org.opengis.metadata.lineage        .Algorithm                           .class,
152               org.opengis.metadata.lineage        .Processing                          .class,
153               org.opengis.metadata.lineage        .ProcessStepReport                   .class,
154               org.opengis.metadata.lineage        .ProcessStep                         .class,
155               org.opengis.metadata.lineage        .Lineage                             .class,
156               org.opengis.metadata.quality        .Scope                               .class,
157               org.opengis.metadata.quality        .StandaloneQualityReportInformation  .class,
158               org.opengis.metadata.quality        .Result                              .class,
159               org.opengis.metadata.quality        .EvaluationMethod                    .class,
160               org.opengis.metadata.quality        .SourceReference                     .class,
161               org.opengis.metadata.quality        .Description                         .class,
162               org.opengis.metadata.quality        .BasicMeasure                        .class,
163               org.opengis.metadata.quality        .Measure                             .class,
164               org.opengis.metadata.quality        .MeasureReference                    .class,
165               org.opengis.metadata.quality        .Element                             .class,
166               org.opengis.metadata.quality        .DataQuality                         .class,
167               org.opengis.metadata.quality        .TemporalQuality                     .class,
168               org.opengis.metadata.quality        .Metaquality                         .class,
169               org.opengis.metadata.quality        .Confidence                          .class,
170               org.opengis.metadata.quality        .Usability                           .class,
171               org.opengis.metadata.quality        .Representativity                    .class,
172               org.opengis.metadata.quality        .DataEvaluation                      .class,
173               org.opengis.metadata.quality        .SampleBasedInspection               .class,
174               org.opengis.metadata.quality        .IndirectEvaluation                  .class,
175               org.opengis.metadata.quality        .Homogeneity                         .class,
176               org.opengis.metadata.quality        .FullInspection                      .class,
177               org.opengis.metadata.quality        .DescriptiveResult                   .class,
178               org.opengis.metadata.quality        .AggregationDerivation               .class,
179               org.opengis.metadata.quality        .PositionalAccuracy                  .class,
180               org.opengis.metadata.quality        .AbsoluteExternalPositionalAccuracy  .class,
181               org.opengis.metadata.quality        .GriddedDataPositionalAccuracy       .class,
182               org.opengis.metadata.quality        .RelativeInternalPositionalAccuracy  .class,
183               org.opengis.metadata.quality        .TemporalAccuracy                    .class,
184               org.opengis.metadata.quality        .TemporalConsistency                 .class,
185               org.opengis.metadata.quality        .TemporalValidity                    .class,
186               org.opengis.metadata.quality        .AccuracyOfATimeMeasurement          .class,
187               org.opengis.metadata.quality        .ThematicAccuracy                    .class,
188               org.opengis.metadata.quality        .ThematicClassificationCorrectness   .class,
189               org.opengis.metadata.quality        .QuantitativeAttributeAccuracy       .class,
190               org.opengis.metadata.quality        .NonQuantitativeAttributeCorrectness .class,
191               org.opengis.metadata.quality        .NonQuantitativeAttributeAccuracy    .class,
192               org.opengis.metadata.quality        .LogicalConsistency                  .class,
193               org.opengis.metadata.quality        .ConceptualConsistency               .class,
194               org.opengis.metadata.quality        .DomainConsistency                   .class,
195               org.opengis.metadata.quality        .FormatConsistency                   .class,
196               org.opengis.metadata.quality        .TopologicalConsistency              .class,
197               org.opengis.metadata.quality        .Completeness                        .class,
198               org.opengis.metadata.quality        .CompletenessCommission              .class,
199               org.opengis.metadata.quality        .CompletenessOmission                .class,
200               org.opengis.metadata.quality        .ConformanceResult                   .class,
201               org.opengis.metadata.quality        .CoverageResult                      .class,
202               org.opengis.metadata.quality        .QuantitativeResult                  .class,
203               org.opengis.metadata.spatial        .Dimension                           .class,
204               org.opengis.metadata.spatial        .GeolocationInformation              .class,
205               org.opengis.metadata.spatial        .GCP                                 .class,
206               org.opengis.metadata.spatial        .GCPCollection                       .class,
207               org.opengis.metadata.spatial        .GeometricObjects                    .class,
208               org.opengis.metadata.spatial        .SpatialRepresentation               .class,
209               org.opengis.metadata.spatial        .GridSpatialRepresentation           .class,
210               org.opengis.metadata.spatial        .VectorSpatialRepresentation         .class,
211               org.opengis.metadata.spatial        .Georectified                        .class,
212               org.opengis.metadata.spatial        .Georeferenceable                    .class,
213               org.opengis.metadata                .FeatureTypeList                     .class,
214               org.opengis.metadata                .ApplicationSchemaInformation        .class,
215               org.opengis.metadata                .ExtendedElementInformation          .class,
216               org.opengis.metadata                .MetadataExtensionInformation        .class,
217               org.opengis.metadata                .PortrayalCatalogueReference         .class,
218               org.opengis.metadata                .MetadataScope                       .class,
219               org.opengis.metadata                .Metadata                            .class,
220               org.opengis.referencing.datum       .Ellipsoid                           .class,
221               org.opengis.referencing.datum       .PrimeMeridian                       .class,
222               org.opengis.referencing.datum       .GeodeticDatum                       .class,
223               org.opengis.referencing.datum       .EngineeringDatum                    .class,
224               org.opengis.referencing.datum       .ImageDatum                          .class,
225               org.opengis.referencing.datum       .ParametricDatum                     .class,
226               org.opengis.referencing.datum       .TemporalDatum                       .class,
227               org.opengis.referencing.datum       .VerticalDatum                       .class,
228               org.opengis.referencing.datum       .DynamicReferenceFrame               .class,
229               org.opengis.referencing.cs          .AffineCS                            .class,
230               org.opengis.referencing.cs          .CartesianCS                         .class,
231               org.opengis.referencing.cs          .CylindricalCS                       .class,
232               org.opengis.referencing.cs          .EllipsoidalCS                       .class,
233               org.opengis.referencing.cs          .LinearCS                            .class,
234               org.opengis.referencing.cs          .ParametricCS                        .class,
235               org.opengis.referencing.cs          .PolarCS                             .class,
236               org.opengis.referencing.cs          .SphericalCS                         .class,
237               org.opengis.referencing.cs          .TimeCS                              .class,
238               org.opengis.referencing.cs          .UserDefinedCS                       .class,
239               org.opengis.referencing.cs          .VerticalCS                          .class,
240               org.opengis.referencing.crs         .SingleCRS                           .class,
241               org.opengis.referencing.crs         .CompoundCRS                         .class,
242               org.opengis.referencing.crs         .EngineeringCRS                      .class,
243               org.opengis.referencing.crs         .GeodeticCRS                         .class,
244               org.opengis.referencing.crs         .GeographicCRS                       .class,
245               org.opengis.referencing.crs         .GeocentricCRS                       .class,
246               org.opengis.referencing.crs         .ImageCRS                            .class,
247               org.opengis.referencing.crs         .ParametricCRS                       .class,
248               org.opengis.referencing.crs         .TemporalCRS                         .class,
249               org.opengis.referencing.crs         .VerticalCRS                         .class,
250               org.opengis.referencing.operation   .Formula                             .class,
251               org.opengis.referencing.operation   .OperationMethod                     .class,
252               org.opengis.referencing.operation   .Matrix                              .class,
253               org.opengis.referencing.operation   .MathTransform                       .class,
254               org.opengis.referencing.operation   .MathTransform1D                     .class,
255               org.opengis.referencing.operation   .MathTransform2D                     .class,
256               org.opengis.referencing.operation   .CoordinateOperation                 .class,
257               org.opengis.referencing.operation   .SingleOperation                     .class,
258               org.opengis.referencing.operation   .ConcatenatedOperation               .class,
259               org.opengis.referencing.operation   .Conversion                          .class,
260               org.opengis.referencing.operation   .Projection                          .class,
261               org.opengis.referencing.operation   .Transformation                      .class,
262               org.opengis.referencing.operation   .PointMotionOperation                .class,
263               org.opengis.referencing.operation   .PassThroughOperation                .class,
264               org.opengis.referencing.crs         .GeneralDerivedCRS                   .class,
265               org.opengis.referencing.crs         .DerivedCRS                          .class,
266               org.opengis.referencing.crs         .ProjectedCRS                        .class,
267               org.opengis.referencing.operation   .ConicProjection                     .class,
268               org.opengis.referencing.operation   .CylindricalProjection               .class,
269               org.opengis.referencing.operation   .PlanarProjection                    .class,
270               org.opengis.feature                 .IdentifiedType                      .class,
271               org.opengis.feature                 .PropertyType                        .class,
272               org.opengis.feature                 .Property                            .class,
273               org.opengis.feature                 .AttributeType                       .class,
274               org.opengis.feature                 .Attribute                           .class,
275               org.opengis.feature                 .DynamicAttributeType                .class,
276               org.opengis.feature                 .DynamicAttribute                    .class,
277               org.opengis.feature                 .FeatureType                         .class,
278               org.opengis.feature                 .Feature                             .class,
279               org.opengis.feature                 .FeatureAssociation                  .class,
280               org.opengis.feature                 .FeatureAssociationRole              .class,
281               org.opengis.feature                 .Operation                           .class,
282               org.opengis.util                    .Factory                             .class,
283               org.opengis.util                    .NameFactory                         .class,
284               org.opengis.referencing             .ObjectFactory                       .class,
285               org.opengis.referencing             .AuthorityFactory                    .class,
286               org.opengis.referencing.datum       .DatumFactory                        .class,
287               org.opengis.referencing.datum       .DatumAuthorityFactory               .class,
288               org.opengis.referencing.cs          .CSFactory                           .class,
289               org.opengis.referencing.cs          .CSAuthorityFactory                  .class,
290               org.opengis.referencing.crs         .CRSFactory                          .class,
291               org.opengis.referencing.crs         .CRSAuthorityFactory                 .class,
292               org.opengis.referencing.operation   .MathTransformFactory                .class,
293               org.opengis.referencing.operation   .CoordinateOperationFactory          .class,
294               org.opengis.referencing.operation   .CoordinateOperationAuthorityFactory .class,
295               org.opengis.referencing.operation   .RegisterOperations                  .class,
296               org.opengis.filter                  .Expression                          .class,
297               org.opengis.filter                  .Literal                             .class,
298               org.opengis.filter                  .ValueReference                      .class,
299               org.opengis.filter                  .Filter                              .class,
300               org.opengis.filter                  .ComparisonOperator                  .class,
301               org.opengis.filter                  .BinaryComparisonOperator            .class,
302               org.opengis.filter                  .BetweenComparisonOperator           .class,
303               org.opengis.filter                  .LikeOperator                        .class,
304               org.opengis.filter                  .NullOperator                        .class,
305               org.opengis.filter                  .NilOperator                         .class,
306               org.opengis.filter                  .SpatialOperator                     .class,
307               org.opengis.filter                  .BinarySpatialOperator               .class,
308               org.opengis.filter                  .DistanceOperator                    .class,
309               org.opengis.filter                  .TemporalOperator                    .class,
310               org.opengis.filter                  .LogicalOperator                     .class,
311               org.opengis.filter                  .Version                             .class,
312               org.opengis.filter                  .ResourceId                          .class,
313               org.opengis.filter                  .SortProperty                        .class,
314               org.opengis.filter                  .SortBy                              .class,
315               org.opengis.filter                  .QueryExpression                     .class,
316               org.opengis.filter.capability       .Conformance                         .class,
317               org.opengis.filter.capability       .IdCapabilities                      .class,
318               org.opengis.filter.capability       .ScalarCapabilities                  .class,
319               org.opengis.filter.capability       .SpatialCapabilities                 .class,
320               org.opengis.filter.capability       .TemporalCapabilities                .class,
321               org.opengis.filter.capability       .AvailableFunction                   .class,
322               org.opengis.filter.capability       .ExtendedCapabilities                .class,
323               org.opengis.filter.capability       .FilterCapabilities                  .class,
324               org.opengis.filter                  .FilterFactory                       .class),
325
326    /**
327     * All code list classes.
328     */
329    @SuppressWarnings("deprecation")
330    CODE_LISTS(
331            org.opengis.metadata                .Datatype                     .class,
332            org.opengis.metadata                .Obligation                   .class,
333            org.opengis.metadata.acquisition    .Context                      .class,
334            org.opengis.metadata.acquisition    .GeometryType                 .class,
335            org.opengis.metadata.acquisition    .ObjectiveType                .class,
336            org.opengis.metadata.acquisition    .OperationType                .class,
337            org.opengis.metadata.acquisition    .Priority                     .class,
338            org.opengis.metadata.acquisition    .Sequence                     .class,
339            org.opengis.metadata.acquisition    .Trigger                      .class,
340            org.opengis.metadata.citation       .DateType                     .class,
341            org.opengis.metadata.citation       .OnLineFunction               .class,
342            org.opengis.metadata.citation       .PresentationForm             .class,
343            org.opengis.metadata.citation       .Role                         .class,
344            org.opengis.metadata.citation       .TelephoneType                .class,
345            org.opengis.metadata.constraint     .Classification               .class,
346            org.opengis.metadata.constraint     .Restriction                  .class,
347            org.opengis.metadata.content        .BandDefinition               .class,
348            org.opengis.metadata.content        .CoverageContentType          .class,
349            org.opengis.metadata.content        .ImagingCondition             .class,
350            org.opengis.metadata.content        .PolarizationOrientation      .class,
351            org.opengis.metadata.content        .TransferFunctionType         .class,
352            org.opengis.metadata.distribution   .MediumFormat                 .class,
353            org.opengis.metadata.distribution   .MediumName                   .class,
354            org.opengis.metadata.identification .AssociationType              .class,
355            org.opengis.metadata.identification .CharacterSet                 .class,
356            org.opengis.metadata.identification .CouplingType                 .class,
357            org.opengis.metadata.identification .DistributedComputingPlatform .class,
358            org.opengis.metadata.identification .InitiativeType               .class,
359            org.opengis.metadata.identification .KeywordType                  .class,
360            org.opengis.metadata.identification .Progress                     .class,
361            org.opengis.metadata.maintenance    .MaintenanceFrequency         .class,
362            org.opengis.metadata.maintenance    .ScopeCode                    .class,
363            org.opengis.metadata.quality        .EvaluationMethodType         .class,
364            org.opengis.metadata.quality        .ValueStructure               .class,
365            org.opengis.metadata.spatial        .CellGeometry                 .class,
366            org.opengis.metadata.spatial        .DimensionNameType            .class,
367            org.opengis.metadata.spatial        .GeometricObjectType          .class,
368            org.opengis.metadata.spatial        .SpatialRepresentationType    .class,
369            org.opengis.metadata.spatial        .TopologyLevel                .class,
370            org.opengis.referencing             .ReferenceSystemType          .class,
371            org.opengis.referencing.cs          .CoordinateDataType           .class,
372            org.opengis.referencing.cs          .AxisDirection                .class,
373            org.opengis.referencing.cs          .RangeMeaning                 .class,
374            org.opengis.referencing.datum       .PixelInCell                  .class,
375            org.opengis.referencing.datum       .RealizationMethod            .class,
376            org.opengis.referencing.datum       .VerticalDatumType            .class,
377            org.opengis.temporal                .IndeterminateValue           .class,
378            org.opengis.filter                  .ComparisonOperatorName       .class,
379            org.opengis.filter                  .SpatialOperatorName          .class,
380            org.opengis.filter                  .DistanceOperatorName         .class,
381            org.opengis.filter                  .TemporalOperatorName         .class,
382            org.opengis.filter                  .LogicalOperatorName          .class),
383
384    /**
385     * All enumeration classes.
386     */
387    ENUMERATIONS(org.opengis.metadata.identification .TopicCategory      .class,
388                 org.opengis.metadata.spatial        .PixelOrientation   .class,
389                 org.opengis.parameter               .ParameterDirection .class,
390                 org.opengis.filter                  .MatchAction        .class,
391                 org.opengis.filter                  .VersionAction      .class,
392                 org.opengis.filter                  .SortOrder          .class),
393
394    /**
395     * The union of code lists and enumerations.
396     */
397    CONTROLLED_VOCABULARY(CODE_LISTS, ENUMERATIONS),
398
399    /**
400     * All exceptions.
401     */
402    EXCEPTIONS(org.opengis.util                  .FactoryException                     .class,
403               org.opengis.util                  .UnimplementedServiceException        .class,
404               org.opengis.util                  .NoSuchIdentifierException            .class,
405               org.opengis.referencing           .NoSuchAuthorityCodeException         .class,
406               org.opengis.referencing.operation .OperationNotFoundException           .class,
407               org.opengis.referencing.operation .TransformException                   .class,
408               org.opengis.referencing.operation .NoninvertibleTransformException      .class,
409               org.opengis.temporal              .IndeterminatePositionException       .class,
410               org.opengis.parameter             .ParameterNotFoundException           .class,
411               org.opengis.parameter             .InvalidParameterNameException        .class,
412               org.opengis.parameter             .InvalidParameterTypeException        .class,
413               org.opengis.parameter             .InvalidParameterValueException       .class,
414               org.opengis.parameter             .InvalidParameterCardinalityException .class,
415               org.opengis.coordinate            .MismatchedCoordinateMetadataException.class,
416               org.opengis.coordinate            .MismatchedDimensionException         .class,
417               org.opengis.feature               .MismatchedFeatureException           .class,
418               org.opengis.feature               .FeatureInstantiationException        .class,
419               org.opengis.feature               .FeatureOperationException            .class,
420               org.opengis.feature               .PropertyNotFoundException            .class,
421               org.opengis.feature               .OutOfTemporalDomainException         .class,
422               org.opengis.feature               .InvalidPropertyValueException        .class,
423               org.opengis.feature               .MultiValuedPropertyException         .class,
424               org.opengis.filter                .InvalidFilterValueException          .class,
425               org.opengis.filter                .DuplicateSortKeyException            .class),
426
427    /**
428     * All interfaces, code lists, enumerations and exceptions.
429     */
430    ALL(CONTROLLED_VOCABULARY, INTERFACES, EXCEPTIONS);
431
432    /**
433     * All types that are members of the category identified by this enumeration value.
434     */
435    private final Class<?>[] types;
436
437    /**
438     * Creates a new enumeration with the given members.
439     *
440     * @param  types  all types that are members of the category identified by this enumeration value.
441     */
442    private Content(final Class<?>... types) {
443        this.types = types;
444    }
445
446    /**
447     * Creates a new enumeration as the union of existing enumerations.
448     *
449     * @param  others  the other enumerations to combine in this one.
450     */
451    private Content(final Content... others) {
452        int length = 0;
453        for (final Content other : others) {
454            length += other.types.length;
455        }
456        types = new Class<?>[length];
457        length = 0;
458        for (final Content other : others) {
459            final int n = other.types.length;
460            System.arraycopy(other.types, 0, types, length, n);
461            length += n;
462        }
463    }
464
465    /**
466     * Returns {@code true} if this enumeration is for enumerations, code lists, or combination of both.
467     *
468     * @return {@code true} if {@link #ENUMERATIONS}, {@link #CODE_LISTS} or {@link #CONTROLLED_VOCABULARY}.
469     */
470    public boolean isControlledVocabulary() {
471        switch (this) {
472            case ENUMERATIONS:
473            case CODE_LISTS:
474            case CONTROLLED_VOCABULARY: return true;
475            default: return false;
476        }
477    }
478
479    /**
480     * Returns all types in that are members of the category identified by this enumeration value.
481     *
482     * @return types that are members of this category.
483     */
484    public Class<?>[] types() {
485        return types.clone();
486    }
487
488    /**
489     * Returns the element type of the given field. If the field type is parameterized, then
490     * this method returns the upper bound. Otherwise this method returns the value type.
491     *
492     * @param  field  the field for which to obtain the (eventually parameterized) type.
493     * @return the property element type.
494     */
495    public static Class<?> typeOf(final Field field) {
496        Class<?> c = getActualTypeArgument(field.getGenericType());
497        if (c == null) {
498            c = field.getType();
499        }
500        return c;
501    }
502
503    /**
504     * Returns the element type of the return value or single parameter type of the given method.
505     * If the return type or the single parameter is a parameterized type, then this method returns
506     * the upper bound. Otherwise this method returns the type directly.
507     *
508     * @param  method  the method for which to obtain the (eventually parameterized) return type.
509     * @return the return element type (may be {@link Void#TYPE}).
510     */
511    public static Class<?> typeOf(final Method method) {
512        Class<?> c = getActualTypeArgument(method.getGenericReturnType());
513        if (c == null) {
514            final Type[] parameters = method.getGenericParameterTypes();
515            if (parameters != null && parameters.length == 1) {
516                c = getActualTypeArgument(parameters[0]);
517            }
518        }
519        if (c == null) {
520            c = method.getReturnType();
521        }
522        return c;
523    }
524
525    /**
526     * Returns {@link ParameterizedType#getActualTypeArguments()} as a {@link Class} or {@code null}.
527     *
528     * @param  type  the type to convert to a class.
529     * @return the given type as a class, or {@code null}.
530     */
531    private static Class<?> getActualTypeArgument(Type type) {
532        if (type instanceof ParameterizedType) {
533            Type[] p = ((ParameterizedType) type).getActualTypeArguments();
534            while (p.length == 1) {
535                type = p[0];
536                if (type instanceof WildcardType) {
537                    p = ((WildcardType) type).getUpperBounds();
538                } else {
539                    if (type instanceof ParameterizedType) {
540                        type = ((ParameterizedType) type).getRawType();
541                    }
542                    if (type instanceof Class<?>) {
543                        return (Class<?>) type;
544                    }
545                    break;                                      // Unknown type.
546                }
547            }
548        }
549        return null;
550    }
551}