---
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) &gt; [@loopback/metadata](./metadata.md) &gt; [MetadataInspector](./metadata.metadatainspector.md) &gt; [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)<!-- -->&lt;T, MethodDecorator&gt;


</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


