Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
 package org.jboss.managed.plugins;
 
 import java.util.Map;
 import java.util.Set;
 
ManagedObjectImpl.

Author(s):
Adrian Brock
Scott.Stark@jboss.org
Version:
$Revision: 80154 $
 
 public class ManagedObjectImpl implements MutableManagedObject
 {
   
The serialVersionUID
 
    private static final long serialVersionUID = 2L;

   
The object name used for ManagementRef resolution
 
    private String name;
   
The name type/qualifier used for ManagementRef resolution
 
    private String nameType;
   
The attachment name
 
    private String attachmentName;

   
The attachment
 
    private transient Object attachment;
   
The object annotations <Class name, Annotation>
 
    private Map<StringAnnotationannotations = Collections.emptyMap();
   
The properties
 
    private Map<StringManagedPropertyproperties;
   
The operations
 
    private Set<ManagedOperationoperations;
   
The option parent of this ManagedObject
 
    private ManagedObject parent;
   
The runtime component name
 
    private transient Object componentName;


   
Create a new ManagedObjectImpl

Parameters:
name - The object name used for ManagementRef resolution
 
    public ManagedObjectImpl(String name)
    {
       this(namenamenulltoMap(null), new HashSet<ManagedOperation>(), null);
    }
   
   
Create a new ManagedObjectImpl

Parameters:
name - The object name used for ManagementRef resolution
properties the properties
 
    public ManagedObjectImpl(String nameSet<ManagedPropertyproperties)
    {
       this(namenamenullpropertiesnew HashSet<ManagedOperation>(), null);
    }

   
Create a new ManagedObjectImpl

Parameters:
name - The object name used for ManagementRef resolution
properties the properties
operations the operations
 
    public ManagedObjectImpl(String nameSet<ManagedPropertyproperties,
          HashSet<ManagedOperationoperations)
   {
      this(namenamenullpropertiesoperationsnull);
   }

   
Create a new ManagedObjectImpl

Parameters:
name - The object name used for ManagementRef resolution
nameType - The name type/qualifier used for ManagementRef resolution
attachmentName the attachment name
properties the properties
operations the operations
attachment the attachment
   public ManagedObjectImpl(
         String name,
         String nameType,
         String attachmentName,
         Set<ManagedPropertyproperties,
         HashSet<ManagedOperationoperations,
         Serializable attachment
   )
   {
      this(namenameTypeattachmentNametoMap(properties), operationsattachment);
   }

   
Create a new ManagedObjectImpl

Parameters:
name - The object name used for ManagementRef resolution
nameType - The name type/qualifier used for ManagementRef resolution
attachmentName the attachment name
properties the properties
operations the operations
attachment the attachment
   public ManagedObjectImpl(
         String name,
         String nameType,
         String attachmentName,
         Map<StringManagedPropertyproperties,
         HashSet<ManagedOperationoperations,
         Serializable attachment
   )
   {
      if (name == null)
         throw new IllegalArgumentException("Null name");
      if (properties == null)
         throw new IllegalArgumentException("Null properties");
      
      this. = name;
      // todo - check for null?
      this. = nameType;
      this. = attachmentName;
      this. = properties;
      this. = operations;
      setAttachment(attachment);
   }
   public String getName()
   {
      return ;
   }
   public void setName(String name)
   {
      this. = name;
   }
   public String getNameType()
   {
      return ;
   }
   public void setNameType(String nameType)
   {
      this. = nameType;
   }
   public String getAttachmentName()
   {
      return ;
   }
   public void setAttachmentName(String attachmentName)
   {
      this. = attachmentName;
   }

   
Get the annotations associated with the property

Returns:
the annotations associated with the property
   {
      return ;
   }
   public void setAnnotations(Map<StringAnnotationannotations)
   {
      if (this..isEmpty())
         this. = new HashMap<StringAnnotation>();
      else
         this..clear();
      this..putAll(annotations);
   }
   public Set<StringgetPropertyNames()
   {
      return .keySet();
   }
   
   public ManagedProperty getProperty(String name)
   {
      if (name == null)
         throw new IllegalArgumentException("Null name");
      
      return .get(name);
   }
   
   {
      return ;
   }
   public void setProperties(Map<StringManagedPropertyproperties)
   {
      this. = properties;
   }
   public Object getAttachment()
   {
      return ;
   }

   
Set the attachment.

Parameters:
attachment the attachment.
   public void setAttachment(Object attachment)
   {
      this. = attachment;
   }

   
get the ManagedOperations

Returns:
set of managed operations
   {
      return ;
   }
   public void setOperations(Set<ManagedOperationoperations)
   {
      this. = operations;
   }
   
   public ManagedObject getParent()
   {
      return ;
   }
   public void setParent(ManagedObject parent)
   {
      this. = parent;
   }
   public Object getComponentName()
   {
      return ;
   }
   public void setComponentName(Object name)
   {
      this. = name;
   }
   public boolean equals(Object obj)
   {
      if (obj == this)
         return true;
      if (obj == null || obj instanceof ManagedObject == false)
         return false;
      
      ManagedObject other = (ManagedObjectobj;
      return getName().equals(other.getName()) && getProperties().equals(other.getProperties());
   }
   
   public int hashCode()
   {
      return .hashCode();
   }
   
   public String toString()
   {
      return "ManagedObject{" +  + "}"
   }

   
Append the name and props

Parameters:
sb the buffer to append the name and props to
   protected void toString(StringBuilder sb)
   {
      sb.append("name=");
      sb.append();
      sb.append(", nameType=");
      sb.append();
      sb.append(", attachmentName=");
      sb.append();
      sb.append(", properties=");
      sb.append();
   }
   private static Map<StringManagedPropertytoMap(Set<ManagedPropertyprops)
   {
      HashMap<StringManagedPropertyproperties = new HashMap<StringManagedProperty>();
      if (props != null && props.isEmpty() == false)
      {
         for (ManagedProperty prop : props)
         {
            properties.put(prop.getName(), prop);
         }
      }
      return properties;
   }
New to GrepCode? Check out our FAQ X