mbeannotificationdescriptor.java

来自「jmx在spring中的实现」· Java 代码 · 共 62 行

JAVA
62
字号
/*
======================================================================

  XMLMBeanNotificationInfo.java

  Created by Claude Duguay
  Copyright (c) 2005

======================================================================
*/

package com.claudeduguay.mbeans.model;

import org.jdom.*;

import javax.management.modelmbean.*;

import com.claudeduguay.util.jdom.*;

public class MBeanNotificationDescriptor
	extends MBeanFeatureDescriptor
	implements IStorableElement
{
	protected String[] types;
	
	public MBeanNotificationDescriptor() {}

	public MBeanNotificationDescriptor(Element element)
	{
		parseElement(element);
	}
	
	public ModelMBeanNotificationInfo createMBeanNotificationInfo()
	{
		return new ModelMBeanNotificationInfo(types, name, description);
	}

	public String[] getNotifyTypes()
	{
		return types;
	}

	public void setNotifyTypes(String[] types)
	{
		this.types = types;
	}
	
	public Element buildElement()
	{
		Element element = super.buildElement();
		element.setName("notification");
		element.setAttribute("types", MBeanDescriptorUtil.buildCommaSeparatedList(getNotifyTypes()));
		return element;
	}
	
	public void parseElement(Element element)
	{
		super.parseElement(element);
		setNotifyTypes(MBeanDescriptorUtil.parseCommaSeparatedList(element.getAttributeValue("types")));
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?