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>beanMapprivate ClassReflectionHelperhelperprivate java.lang.Objectmetadataprivate java.lang.Stringnameprivate WriteableBeanDatabaseImplparent
-
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 InstanceaddInstance(java.lang.String key, java.lang.Object bean)Adds the instance with the given key to the typeInstanceaddInstance(java.lang.String key, java.lang.Object bean, java.lang.Object metadata)Adds the instance with the given key to the type(package private) ClassReflectionHelpergetHelper()InstancegetInstance(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.ObjectgetMetadata()Gets information about this type.java.lang.StringgetName()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 keyInstanceremoveInstance(java.lang.String key)Removes the instance with the given key from the typevoidsetMetadata(java.lang.Object metadata)Sets an object containing information about this type.java.lang.StringtoString()
-
-
-
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:TypeA unique identifier for this type
-
getInstances
public java.util.Map<java.lang.String,Instance> getInstances()
Description copied from interface:TypeReturns a read-only map of the instances that are associated with this type- Specified by:
getInstancesin 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:TypeGets the instance associated with this key, or null if there is none- Specified by:
getInstancein 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:WriteableTypeAdds the instance with the given key to the type- Specified by:
addInstancein 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:WriteableTypeAdds the instance with the given key to the type- Specified by:
addInstancein 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:WriteableTypeRemoves the instance with the given key from the type- Specified by:
removeInstancein 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:WriteableTypeModifies the instance with the given key- Specified by:
modifyInstancein 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:TypeGets information about this type. Can be used to describe the type in some useful way- Specified by:
getMetadatain interfaceType- Returns:
- The possibly null metadata associated with this type
-
setMetadata
public void setMetadata(java.lang.Object metadata)
Description copied from interface:TypeSets an object containing information about this type. Can be used to describe the type in some useful way- Specified by:
setMetadatain interfaceType- Parameters:
metadata- The possibly null metadata to be associated with this type
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-