Class WriteableTypeImpl
- java.lang.Object
-
- org.glassfish.hk2.configuration.hub.internal.WriteableTypeImpl
-
- All Implemented Interfaces:
Type
,WriteableType
public class WriteableTypeImpl extends java.lang.Object implements WriteableType
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap<java.lang.String,Instance>
beanMap
private ClassReflectionHelper
helper
private java.lang.Object
metadata
private java.lang.String
name
private WriteableBeanDatabaseImpl
parent
-
Constructor Summary
Constructors Constructor Description WriteableTypeImpl(WriteableBeanDatabaseImpl parent, java.lang.String name)
WriteableTypeImpl(WriteableBeanDatabaseImpl parent, TypeImpl mother)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Instance
addInstance(java.lang.String key, java.lang.Object bean)
Adds the instance with the given key to the typeInstance
addInstance(java.lang.String key, java.lang.Object bean, java.lang.Object metadata)
Adds the instance with the given key to the type(package private) ClassReflectionHelper
getHelper()
Instance
getInstance(java.lang.String key)
Gets the instance associated with this key, or null if there is nonejava.util.Map<java.lang.String,Instance>
getInstances()
Returns a read-only map of the instances that are associated with this typejava.lang.Object
getMetadata()
Gets information about this type.java.lang.String
getName()
A unique identifier for this typejava.beans.PropertyChangeEvent[]
modifyInstance(java.lang.String key, java.lang.Object newBean, java.beans.PropertyChangeEvent... propChanges)
Modifies the instance with the given keyInstance
removeInstance(java.lang.String key)
Removes the instance with the given key from the typevoid
setMetadata(java.lang.Object metadata)
Sets an object containing information about this type.java.lang.String
toString()
-
-
-
Field Detail
-
parent
private final WriteableBeanDatabaseImpl parent
-
name
private final java.lang.String name
-
beanMap
private final java.util.HashMap<java.lang.String,Instance> beanMap
-
helper
private final ClassReflectionHelper helper
-
metadata
private java.lang.Object metadata
-
-
Constructor Detail
-
WriteableTypeImpl
WriteableTypeImpl(WriteableBeanDatabaseImpl parent, TypeImpl mother)
-
WriteableTypeImpl
WriteableTypeImpl(WriteableBeanDatabaseImpl parent, java.lang.String name)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:Type
A unique identifier for this type
-
getInstances
public java.util.Map<java.lang.String,Instance> getInstances()
Description copied from interface:Type
Returns a read-only map of the instances that are associated with this type- Specified by:
getInstances
in interfaceType
- Returns:
- A read-only and possibly empty map of instances associated with this type
-
getInstance
public Instance getInstance(java.lang.String key)
Description copied from interface:Type
Gets the instance associated with this key, or null if there is none- Specified by:
getInstance
in interfaceType
- Parameters:
key
- The non-null key for the instance- Returns:
- The resulting instance or null if there is none
-
addInstance
public Instance addInstance(java.lang.String key, java.lang.Object bean)
Description copied from interface:WriteableType
Adds the instance with the given key to the type- Specified by:
addInstance
in interfaceWriteableType
- Parameters:
key
- A non-null name for this beanbean
- The non-null bean to add- Returns:
- The instance that was created
-
addInstance
public Instance addInstance(java.lang.String key, java.lang.Object bean, java.lang.Object metadata)
Description copied from interface:WriteableType
Adds the instance with the given key to the type- Specified by:
addInstance
in interfaceWriteableType
- Parameters:
key
- A non-null name for this beanbean
- The non-null bean to addmetadata
- Possibly null metadata to be associated with this bean- Returns:
- The instance that was created
-
removeInstance
public Instance removeInstance(java.lang.String key)
Description copied from interface:WriteableType
Removes the instance with the given key from the type- Specified by:
removeInstance
in interfaceWriteableType
- Parameters:
key
- A non-null name for this bean- Returns:
- The possibly null bean that was removed. If null then no bean was found with the given name
-
modifyInstance
public java.beans.PropertyChangeEvent[] modifyInstance(java.lang.String key, java.lang.Object newBean, java.beans.PropertyChangeEvent... propChanges)
Description copied from interface:WriteableType
Modifies the instance with the given key- Specified by:
modifyInstance
in interfaceWriteableType
- Parameters:
key
- A non-null name or key for the bean to modifynewBean
- The new bean to use with this keypropChanges
- The full set of changes from the previous version. If this is a zero-length array then the system will attempt to automatically determine the changes made to this type and will generate the list of PropertyChangeEvent to be associated with this modification- Returns:
- If changes has length greater than zero then this simply returns changes. If changes is zero length then this will return the set of changes automatically determined by the system
-
getHelper
ClassReflectionHelper getHelper()
-
getMetadata
public java.lang.Object getMetadata()
Description copied from interface:Type
Gets information about this type. Can be used to describe the type in some useful way- Specified by:
getMetadata
in interfaceType
- Returns:
- The possibly null metadata associated with this type
-
setMetadata
public void setMetadata(java.lang.Object metadata)
Description copied from interface:Type
Sets an object containing information about this type. Can be used to describe the type in some useful way- Specified by:
setMetadata
in interfaceType
- Parameters:
metadata
- The possibly null metadata to be associated with this type
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-