@loopback/docs
Version:
Documentation files rendered at [https://loopback.io](https://loopback.io)
113 lines (55 loc) • 1.92 kB
Markdown
---
lang: en
title: 'API docs: metadata.metadatainspector.getmethodmetadata'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/metadata
permalink: /doc/en/lb4/apidocs.metadata.metadatainspector.getmethodmetadata.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/metadata](./metadata.md) > [MetadataInspector](./metadata.metadatainspector.md) > [getMethodMetadata](./metadata.metadatainspector.getmethodmetadata.md)
## MetadataInspector.getMethodMetadata() method
Get the metadata associated with the given key for a given method of the target class or prototype
**Signature:**
```typescript
static getMethodMetadata<T>(key: MetadataKey<T, MethodDecorator>, target: Object, methodName?: string, options?: InspectionOptions): T | undefined;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td markdown="1">
key
</td><td markdown="1">
[MetadataKey](./metadata.metadatakey.md)<!-- --><T, MethodDecorator>
</td><td markdown="1">
Metadata key
</td></tr>
<tr><td markdown="1">
target
</td><td markdown="1">
Object
</td><td markdown="1">
Class for static methods or prototype for instance methods
</td></tr>
<tr><td markdown="1">
methodName
</td><td markdown="1">
string
</td><td markdown="1">
_(Optional)_ Method name. If not present, default to '' to use the constructor
</td></tr>
<tr><td markdown="1">
options
</td><td markdown="1">
[InspectionOptions](./metadata.inspectionoptions.md)
</td><td markdown="1">
_(Optional)_ Options for inspection
</td></tr>
</tbody></table>
**Returns:**
T \| undefined