objectHasMetaData (metadataKey, metadataValue) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. list-table:: :widths: 20 80 :header-rows: 0 :class: tight-table * - Category - metadata functions * - Signature - objectHasMetaData(String metadataKey, String metadataValue) : boolean * - Description - checks if an object has a certain metadata key with a certain metadata value * - Arguments - - metadataKey: key of metadata to check for existence - metadataValue: value of metadata to check for existence * - Returns - - true if the model object in the context has the metadata key with the given metadata value - false if the model object in the context does not have the metadata key or has the metadata key with a metadata value different from the given metadata value * - Exceptions - .. error:: This function raises a *No model object in context* exception when the context does not contain a model object * - Example - The following example shows parts of a code instruction that generates a Java class for each object that has metadata createSpecialService with value true. Given the input shown in the input section below CodeComposer will generate this class only for object *ExampleObject3* as shown in the output section below. **Input** .. code-block:: xml :caption: src/codeinstruction/examples/example-code-instruction-special-service-object-has-meta-data-with-value.xml :name: ObjectHasMetaDataWithValue_CodeInstruction :linenos: :emphasize-lines: 9 .. code-block:: xml :caption: src/model/model.xml :name: ObjectHasMetaDataWithValue_Model :linenos: :emphasize-lines: 6, 11, 16 false true **Output** .. code-block:: java :caption: src/main/java/io/metafactory/codecomposer_reference/services/special/ExampleObject3SpecialService.java :name: ObjectHasMetaDataWithValue_Output1 :linenos: :emphasize-lines: 3 package io.metafactory.codecomposer_reference.services.special; public class ExampleObject3SpecialService { }