Package org.djutils.metadata
Class MetaData
java.lang.Object
org.djutils.metadata.MetaData
MetaDataInterface; documenting Object arrays. 
Copyright (c) 2020-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
Copyright (c) 2020-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
- Author:
 - Alexander Verbraeck, Peter Knoppers
 
- 
Field Summary
Fields - 
Constructor Summary
ConstructorsConstructorDescriptionMetaData(String name, String description, ObjectDescriptor... objectDescriptors) Construct a new MetaData object that can check an array of Object. - 
Method Summary
Modifier and TypeMethodDescriptionbooleanRetrieve the description of this MetaData object.getFieldName(int index) Retrieve the name of one element in the Object array.getName()Retrieve the name of this MetaData object.Class<?>getObjectClass(int index) Retrieve the java class of one element in the Object array.getObjectDescription(int index) Retrieve the description of one element in the Object array.getObjectDescriptor(int index) Select one of the ObjectDescriptors.Returns a safe copy of the object descriptors.inthashCode()intsize()Retrieve the length of described Object array.toString()final voidverifyComposition(Object object) Verify that an Object has the prescribed composition.final voidverifyComposition(Object[] objectArray) Verify that an Object array has the prescribed composition. 
- 
Field Details
- 
EMPTY
MetaData object that indicates no data is expected. - 
NO_META_DATA
Meta data object to use when none is available. Please do not use this, except when the payload is varying. 
 - 
 - 
Constructor Details
- 
MetaData
Construct a new MetaData object that can check an array of Object.- Parameters:
 name- name of the new MetaData object, which cannot be null or the empty stringdescription- description of the new MetaData objectobjectDescriptors- array of ObjectDescriptor. This constructor does <b>not</b> make a deep copy of this array; subsequent modification of the contents of the providedobjectDescriptorsarray will affect the behavior of the MetaData object.
 
 - 
 - 
Method Details
- 
getName
Retrieve the name of this MetaData object.- Returns:
 - the name of this MetaData object
 
 - 
getDescription
Retrieve the description of this MetaData object.- Returns:
 - the description of this MetaData object
 
 - 
size
public int size()Retrieve the length of described Object array.- Returns:
 - the length of the described Object array; returns 0 if this MetaDataObject is not set up to validate an array of Object.
 
 - 
getObjectDescriptors
Returns a safe copy of the object descriptors. As the object descriptors are immutable objects, they are not cloned.- Returns:
 - a safe copy of the object descriptors
 
 - 
getFieldName
Retrieve the name of one element in the Object array.- Parameters:
 index- index of the element in the Object array (must be 0 if this MetaData object is not set up to validate an array of Object)- Returns:
 - name of the argument
 
 - 
getObjectDescription
Retrieve the description of one element in the Object array.- Parameters:
 index- index of the element in the Object array (must be 0 if this MetaData object is not set up to validate an array of Object)- Returns:
 - description of the argument
 
 - 
getObjectClass
Retrieve the java class of one element in the Object array.- Parameters:
 index- index of the element in the Object array (must be 0 if this MetaData object is not set up to validate an array of Object)- Returns:
 - java class of the element
 
 - 
getObjectDescriptor
Select one of the ObjectDescriptors.- Parameters:
 index- index of the ObjectDescriptor (must be 0 in case this MetaData object is not set up to validate an array of Object)- Returns:
 - the selected ObjectDescriptor
 
 - 
verifyComposition
Verify that an Object array has the prescribed composition.- Parameters:
 objectArray- the Object array to verify. If the array is supposed to have 0 length, a null pointer is deemed OK.- Throws:
 NullPointerException- when the object array is null and the size of the object descriptors array is not 0 or 1IndexOutOfBoundsException- when size of the object descriptors array is not equal to the size of the object arrayClassCastException- when one of the objects is of the wrong class
 - 
verifyComposition
Verify that an Object has the prescribed composition. In order for one object to fit the metadata, the array of expected objects needs to have a length of 1.- Parameters:
 object- the Object to verify.- Throws:
 IndexOutOfBoundsException- when size of the object descriptors array is not 1ClassCastException- when the object is of the wrong class
 - 
hashCode
public int hashCode() - 
equals
 - 
toString
 
 -