Package org.djutils.metadata
Class MetaData
java.lang.Object
org.djutils.metadata.MetaData
public class MetaData extends Object
MetaDataInterface; documenting Object arrays.
Copyright (c) 2020-2020 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-2020 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
-
Constructor Summary
Constructors Constructor Description MetaData(String name, String description, ObjectDescriptor objectDescriptor)
Construct a new MetaData object that can check a single Object..MetaData(String name, String description, ObjectDescriptor[] objectDescriptors)
Construct a new MetaData object that can check an array of Object. -
Method Summary
Modifier and Type Method Description String
getDescription()
Retrieve the description of this MetaData object.String
getFieldName(int index)
Retrieve the name of one element in the Object array.String
getName()
Retrieve the name of this MetaData object.Class<?>
getObjectClass(int index)
Retrieve the java class of one element in the Object array.String
getObjectDescription(int index)
Retrieve the description of one element in the Object array.ObjectDescriptor
getObjectDescriptor(int index)
Select one of the ObjectDescriptors.int
size()
Retrieve the length of described Object array.String
toString()
void
verifyComposition(Object object)
Verify that an Object has the prescribed composition.void
verifyComposition(Object[] objectArray)
Verify that an Object array has the prescribed composition.
-
Constructor Details
-
MetaData
Construct a new MetaData object that can check an array of Object.- Parameters:
name
- String; name of the new MetaData objectdescription
- String; description of the new MetaData objectobjectDescriptors
- ObjectDescriptor[]; array of ObjectDescriptor. This constructor does not make a deep copy of this array; subsequent modification of the contents of the providedobjectDescriptors
array will affect the behavior of the MetaData object.
-
MetaData
Construct a new MetaData object that can check a single Object..- Parameters:
name
- String; name of the new MetaData objectdescription
- String; description of the new MetaData objectobjectDescriptor
- ObjectDescriptor; the descriptor for the object that the new MetaData object will accept as valid
-
-
Method Details
-
getName
Retrieve the name of this MetaData object.- Returns:
- String; the name of this MetaData object
-
getDescription
Retrieve the description of this MetaData object.- Returns:
- String; the description of this MetaData object
-
size
public int size()Retrieve the length of described Object array.- Returns:
- int; the length of the described Object array; returns 0 if this MetaDataObject is not set up to validate an array of Object.
-
getFieldName
Retrieve the name of one element in the Object array.- Parameters:
index
- int; 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:
- String; name of the argument
-
getObjectDescription
Retrieve the description of one element in the Object array.- Parameters:
index
- int; 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:
- String; description of the argument
-
getObjectClass
Retrieve the java class of one element in the Object array.- Parameters:
index
- int; 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:
- Class<?>; java class of the element
-
getObjectDescriptor
Select one of the ObjectDescriptors.- Parameters:
index
- int; index of the ObjectDescriptor (must be 0 in case this MetaData object is not set up to validate an array of Object)- Returns:
- ObjectDescriptor; the selected ObjectDescriptor
-
verifyComposition
Verify that an Object array has the prescribed composition.- Parameters:
objectArray
- Object[]; the Object array to verify. If the array is supposed to have 0 length, a null pointer is deemed OK.
-
verifyComposition
Verify that an Object has the prescribed composition.- Parameters:
object
- Object; the Object to verify.
-
toString
-