org.jboss.managed.plugins
Class ManagedPropertyImpl

java.lang.Object
  extended by org.jboss.managed.plugins.ManagedPropertyImpl
All Implemented Interfaces:
Serializable, ManagedProperty, TransientAttachments
Direct Known Subclasses:
WritethroughManagedPropertyImpl

public class ManagedPropertyImpl
extends Object
implements ManagedProperty

ManagedProperty.

Version:
$Revision: 89200 $
Author:
Adrian Brock, Scott.Stark@jboss.org
See Also:
Serialized Form

Constructor Summary
ManagedPropertyImpl(Fields fields)
          Create a new ManagedProperty that is not associated to a ManagedObject.
ManagedPropertyImpl(ManagedObject managedObject, Fields fields)
          Create a new ManagedProperty.
ManagedPropertyImpl(String name)
          Create a new ManagedProperty that is not associated to a ManagedObject.
 
Method Summary
 String checkValidValue(MetaValue value)
          Check whether this is a valid value
 ManagedProperty copy()
          Create a copy of the managed property.
 boolean equals(Object obj)
           
 ActivationPolicy getActivationPolicy()
          Get the activation policy for property value updates.
 Collection<String> getAdminViewUses()
          Return the admin view names associated with the property
 Map<String,Annotation> getAnnotations()
          Get the annotations associated with the property
 MetaValue getDefaultValue()
          Get the property default value if one exists.
 String getDescription()
          Get the description
<T> T
getField(String fieldName, Class<T> expected)
          Get a field
 Fields getFields()
          Get the fields
 Set<MetaValue> getLegalValues()
          Get the legal values
 ManagedObject getManagedObject()
          Get the managed object the property is associated with.
 String getMappedName()
          Get the property's mapped name.
 Comparable<MetaValue> getMaximumValue()
          Get the maximum value
 MetaType getMetaType()
          Get the type
 Comparable<MetaValue> getMinimumValue()
          Get the minimum value
 String getName()
          Get the property's name
 ManagedObject getTargetManagedObject()
          Get the ManagedObject
<T> T
getTransientAttachment(Class<T> expectedType)
          Get an attachment from the parameter, uses the expected type as both the name and to cast the resulting object.
 Object getTransientAttachment(String name)
          Get a transient attachment from the parameter.
 MetaValue getValue()
          Get the value
 ViewUse[] getViewUse()
           
 boolean hasAnnotation(String key)
          Does the property have the annotation referenced by key.
 int hashCode()
           
 boolean hasViewUse(ViewUse use)
          See if the property has the indicated ViewUse among its
 boolean isMandatory()
          Whether the property is mandatory
 boolean isModified()
          Whether the property has been edited/modified.
 boolean isReadOnly()
          Whether the property is read only
 boolean isRemoved()
          Whether the property has been marked as removed from its ManagedObject.
 void setActivationPolicy(ActivationPolicy policy)
           
 void setAdminViewUses(Collection<String> viewUses)
           
 void setAnnotations(Map<String,Annotation> annotations)
           
 void setDescription(String description)
          Set the description
 void setField(String fieldName, Serializable value)
          Set a field
 void setLegalValues(Set<MetaValue> values)
          Set the legal values
 void setManagedObject(ManagedObject managedObject)
          Set managed object
 void setMandatory(boolean flag)
          Set whether the field is mandatory
 void setMaximumValue(Comparable<MetaValue> value)
          Set the maximum value
 void setMetaType(MetaType type)
          Set the meta type
 void setMinimumValue(Comparable<MetaValue> value)
          Set the minimum value
 void setModified(boolean flag)
          Set the modified state of the property value.
 void setReadOnly(boolean flag)
           
 void setRemoved(boolean flag)
          Set whether the property is removed
 void setTargetManagedObject(ManagedObject target)
           
 void setTransientAttachment(String name, Object attachment)
          Set an transient attachment against the parameter.
 void setValue(MetaValue value)
          Set the value
 void setViewUse(ViewUse[] use)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ManagedPropertyImpl

public ManagedPropertyImpl(String name)
Create a new ManagedProperty that is not associated to a ManagedObject.

Parameters:
name - the managed property name
Throws:
IllegalArgumentException - for null fields or missing Fields.NAME

ManagedPropertyImpl

public ManagedPropertyImpl(Fields fields)
Create a new ManagedProperty that is not associated to a ManagedObject.

Parameters:
fields - the fields
Throws:
IllegalArgumentException - for null fields or missing Fields.NAME

ManagedPropertyImpl

public ManagedPropertyImpl(ManagedObject managedObject,
                           Fields fields)
Create a new ManagedProperty.

Parameters:
managedObject - the managed object, may be null
fields - the fields
Throws:
IllegalArgumentException - for null fields or missing Fields.NAME
Method Detail

getManagedObject

public ManagedObject getManagedObject()
Description copied from interface: ManagedProperty
Get the managed object the property is associated with.

Specified by:
getManagedObject in interface ManagedProperty
Returns:
the managed object

setManagedObject

public void setManagedObject(ManagedObject managedObject)
Set managed object

Specified by:
setManagedObject in interface ManagedProperty
Parameters:
managedObject - the managed object

getTargetManagedObject

public ManagedObject getTargetManagedObject()
Description copied from interface: ManagedProperty
Get the ManagedObject

Specified by:
getTargetManagedObject in interface ManagedProperty
Returns:
the ManagedObject the property references, null if there is no reference or its unresolved.
See Also:
ManagementObjectRef}

setTargetManagedObject

public void setTargetManagedObject(ManagedObject target)
Specified by:
setTargetManagedObject in interface ManagedProperty

getFields

public Fields getFields()
Description copied from interface: ManagedProperty
Get the fields

Specified by:
getFields in interface ManagedProperty
Returns:
the fields

getField

public <T> T getField(String fieldName,
                      Class<T> expected)
Description copied from interface: ManagedProperty
Get a field

Specified by:
getField in interface ManagedProperty
Type Parameters:
T - the expected type
Parameters:
fieldName - the field name
expected - the expected type
Returns:
the value

setField

public void setField(String fieldName,
                     Serializable value)
Description copied from interface: ManagedProperty
Set a field

Specified by:
setField in interface ManagedProperty
Parameters:
fieldName - the field name
value - the value

getName

public String getName()
Description copied from interface: ManagedProperty
Get the property's name

Specified by:
getName in interface ManagedProperty
Returns:
the property's name

getMappedName

public String getMappedName()
Description copied from interface: ManagedProperty
Get the property's mapped name. This is an optional name that allows for an external name to be mapped to an internal one.

Specified by:
getMappedName in interface ManagedProperty
Returns:
the mapped name if it exists, null if there is no mapped name.

getDescription

public String getDescription()
Description copied from interface: ManagedProperty
Get the description

Specified by:
getDescription in interface ManagedProperty
Returns:
the description

setDescription

public void setDescription(String description)
Set the description

Parameters:
description - the description

getAnnotations

public Map<String,Annotation> getAnnotations()
Get the annotations associated with the property

Specified by:
getAnnotations in interface ManagedProperty
Returns:
the annotations associated with the property

setAnnotations

public void setAnnotations(Map<String,Annotation> annotations)

hasAnnotation

public boolean hasAnnotation(String key)
Description copied from interface: ManagedProperty
Does the property have the annotation referenced by key.

Specified by:
hasAnnotation in interface ManagedProperty
Parameters:
key - the key into ManagedProperty.getAnnotations()
Returns:
true if the annotation exists, false otherwise.

hasViewUse

public boolean hasViewUse(ViewUse use)
See if the property has the indicated ViewUse among its

Specified by:
hasViewUse in interface ManagedProperty
Parameters:
use - - the ViewUse to check for
Returns:
true if the ViewUse exists in the property uses, false otherwise

getMetaType

public MetaType getMetaType()
Description copied from interface: ManagedProperty
Get the type

Specified by:
getMetaType in interface ManagedProperty
Returns:
the type

setMetaType

public void setMetaType(MetaType type)
Set the meta type

Parameters:
type - the meta type

getValue

public MetaValue getValue()
Description copied from interface: ManagedProperty
Get the value

Specified by:
getValue in interface ManagedProperty
Returns:
the value

setValue

public void setValue(MetaValue value)
Description copied from interface: ManagedProperty
Set the value

Specified by:
setValue in interface ManagedProperty
Parameters:
value - the value

getViewUse

public ViewUse[] getViewUse()

setViewUse

public void setViewUse(ViewUse[] use)

getAdminViewUses

public Collection<String> getAdminViewUses()
Description copied from interface: ManagedProperty
Return the admin view names associated with the property

Specified by:
getAdminViewUses in interface ManagedProperty
Returns:
the potentially empty admin view names associated with the property

setAdminViewUses

public void setAdminViewUses(Collection<String> viewUses)

getActivationPolicy

public ActivationPolicy getActivationPolicy()
Description copied from interface: ManagedProperty
Get the activation policy for property value updates.

Specified by:
getActivationPolicy in interface ManagedProperty
Returns:
the property activation policy

setActivationPolicy

public void setActivationPolicy(ActivationPolicy policy)

getLegalValues

public Set<MetaValue> getLegalValues()
Description copied from interface: ManagedProperty
Get the legal values

Specified by:
getLegalValues in interface ManagedProperty
Returns:
the legal values

setLegalValues

public void setLegalValues(Set<MetaValue> values)
Set the legal values

Parameters:
values - the values

getDefaultValue

public MetaValue getDefaultValue()
Description copied from interface: ManagedProperty
Get the property default value if one exists.

Specified by:
getDefaultValue in interface ManagedProperty
Returns:
the default value if one exists, null otherwise.

getMinimumValue

public Comparable<MetaValue> getMinimumValue()
Description copied from interface: ManagedProperty
Get the minimum value

Specified by:
getMinimumValue in interface ManagedProperty
Returns:
the minimum value, a MetaValue implementing Comparable

setMinimumValue

public void setMinimumValue(Comparable<MetaValue> value)
Set the minimum value

Parameters:
value - the value

getMaximumValue

public Comparable<MetaValue> getMaximumValue()
Description copied from interface: ManagedProperty
Get the maximum value

Specified by:
getMaximumValue in interface ManagedProperty
Returns:
the maximum value, a MetaValue implementing Comparable

setMaximumValue

public void setMaximumValue(Comparable<MetaValue> value)
Set the maximum value

Parameters:
value - the value

checkValidValue

public String checkValidValue(MetaValue value)
Description copied from interface: ManagedProperty
Check whether this is a valid value

Specified by:
checkValidValue in interface ManagedProperty
Parameters:
value - the value
Returns:
null for a valid value, an error message otherwise

isMandatory

public boolean isMandatory()
Description copied from interface: ManagedProperty
Whether the property is mandatory

Specified by:
isMandatory in interface ManagedProperty
Returns:
true when mandatory

isReadOnly

public boolean isReadOnly()
Description copied from interface: ManagedProperty
Whether the property is read only

Specified by:
isReadOnly in interface ManagedProperty
Returns:
true when read only

setReadOnly

public void setReadOnly(boolean flag)

isModified

public boolean isModified()
Description copied from interface: ManagedProperty
Whether the property has been edited/modified.

Specified by:
isModified in interface ManagedProperty
Returns:
true when modified

setModified

public void setModified(boolean flag)
Description copied from interface: ManagedProperty
Set the modified state of the property value.

Specified by:
setModified in interface ManagedProperty
Parameters:
flag - - whether the property has been modified

setMandatory

public void setMandatory(boolean flag)
Set whether the field is mandatory

Parameters:
flag - true for mandatory

isRemoved

public boolean isRemoved()
Description copied from interface: ManagedProperty
Whether the property has been marked as removed from its ManagedObject.

Specified by:
isRemoved in interface ManagedProperty
Returns:
true is the property has been removed.

setRemoved

public void setRemoved(boolean flag)
Set whether the property is removed

Specified by:
setRemoved in interface ManagedProperty
Parameters:
flag - true for removed

getTransientAttachment

public <T> T getTransientAttachment(Class<T> expectedType)
Description copied from interface: TransientAttachments
Get an attachment from the parameter, uses the expected type as both the name and to cast the resulting object.

Specified by:
getTransientAttachment in interface TransientAttachments
Type Parameters:
T - the expected type
Parameters:
expectedType - the expected type
Returns:
the attachment

getTransientAttachment

public Object getTransientAttachment(String name)
Description copied from interface: TransientAttachments
Get a transient attachment from the parameter.

Specified by:
getTransientAttachment in interface TransientAttachments
Parameters:
name - the name
Returns:
the attachment
See Also:
TransientAttachments.setTransientAttachment(String, Object)

setTransientAttachment

public void setTransientAttachment(String name,
                                   Object attachment)
Description copied from interface: TransientAttachments
Set an transient attachment against the parameter. A transient attachment is one that will not be available to clients of the parameter, typically admin tools. Such attachments are used by the server side where the underlying metadata to which the parameter is associated is available.

Specified by:
setTransientAttachment in interface TransientAttachments
Parameters:
name - the name
attachment - the attachment, pass null to remove an attachment

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

copy

public ManagedProperty copy()
Description copied from interface: ManagedProperty
Create a copy of the managed property. This is a copy that whose fields are copies of the original property. Changes to the copies fields have not affect on the original.

Specified by:
copy in interface ManagedProperty
Returns:
a copy of the managed property.


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.