@Retention(value=RUNTIME) @Target(value=METHOD) @Inherited public @interface MOperation
Use this annotation to manage a method as operation of a MBean
.
Example:
@MBean
public class MyBean { private int count;@MOperation
private void increaseCounter() { return count++; } }
This bean provides an operation increaseCounter
You can use EL expressions to dynamically resolve the name and description of the managed operation.
E.g. #{name} will be replaced by the value of the field name if it exists or the value returned by method getName().
Also complex expressions like #{pmv.application.name}
works.
Example:
@MBean
(value="Test:type=TestType") public class TestBean {@MInclude
private Counter errors = new Counter("errors"); } public static class Counter { private int cnt=0; private String name; public Counter(String name) { this.name = name; } public String getCapitalizedName() { return StringUtils.capitalize(name); }@MOperation
(name="reset#{capitalizedName}", description="Resets the #{name} counter") public void resetCnt() { cnt = 0; } }
Modifier and Type | Optional Element and Description |
---|---|
String |
description |
MOperation.Impact |
impact |
String |
name |
String[] |
paramDescriptions |
String[] |
params |
public abstract String name
public abstract String description
public abstract String[] params
public abstract String[] paramDescriptions
public abstract MOperation.Impact impact
MBeanOperationInfo.getImpact()
Copyright © 2016 AXON IVY AG. All rights reserved.