(Object bean)
| 88 | } |
| 89 | |
| 90 | MBean(Object bean) { |
| 91 | this.bean = bean; |
| 92 | |
| 93 | ManagedService mBean = bean.getClass().getAnnotation(ManagedService.class); |
| 94 | if (mBean == null) { |
| 95 | throw new IllegalArgumentException( |
| 96 | String.format("%s has no @ManagedService annotation", bean.getClass().getName())); |
| 97 | } |
| 98 | |
| 99 | String name = bean.getClass().getName(); |
| 100 | String description = mBean.description(); |
| 101 | collectAttributeInfo(bean); |
| 102 | @Nullable MBeanAttributeInfo[] attributes = |
| 103 | attributeMap.values().stream() |
| 104 | .map(AttributeInfo::getMBeanAttributeInfo) |
| 105 | .toArray(MBeanAttributeInfo[]::new); |
| 106 | collectOperationInfo(bean); |
| 107 | MBeanOperationInfo[] operations = |
| 108 | operationMap.values().stream() |
| 109 | .map(OperationInfo::getMBeanOperationInfo) |
| 110 | .toArray(MBeanOperationInfo[]::new); |
| 111 | |
| 112 | beanInfo = new MBeanInfo(name, description, attributes, null, operations, null); |
| 113 | objectName = generateObjectName(bean); |
| 114 | } |
| 115 | |
| 116 | private void collectAttributeInfo(Object bean) { |
| 117 | Stream.of(bean.getClass().getMethods()) |
nothing calls this directly
no test coverage detected