Class PropertyFileHandleImpl
java.lang.Object
org.glassfish.hk2.configuration.persistence.properties.internal.PropertyFileHandleImpl
- All Implemented Interfaces:
PropertyFileHandle
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final Stringprivate final Hubprivate HashMap<PropertyFileHandleImpl.TypeData, Map<String, String>> private final Objectprivate static final intprivate booleanprivate final ClassReflectionHelperprivate static final charprivate static Stringprivate final String -
Constructor Summary
ConstructorsConstructorDescriptionPropertyFileHandleImpl(String specificType, String defaultType, String defaultInstanceName, Hub hub) -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddMultiValue(Map<PropertyFileHandleImpl.TypeData, Map<String, String>> buildMe, PropertyFileHandleImpl.TypeData key, String param, String value) private voidaddValues(WriteableBeanDatabase wbd, HashMap<PropertyFileHandleImpl.TypeData, Map<String, String>> allBeans) private ObjectconvertBean(String typeName, Map<String, String> rawBean) private ObjectconvertValue(String value, Class<?> intoMe) voiddispose()Will remove any instances added by this handle from the hub, and make it such that this handle can no longer be usedprivate static Stringprivate voidextractData(String keyString, String value, Map<PropertyFileHandleImpl.TypeData, Map<String, String>> buildMe) private MethodfindMethod(Class<?> clazz, Set<String> possibleSetterNames) private StringgetDefaultInstance(String instanceString) Gets the default instance name that will be given to instances whose name cannot otherwise be determinedReturns the default type name if the type cannot be determined from the key of the property.private StringgetDefaultType(String typeString) private static StringgetDefaultType(String typeString, String defaultDefault, String defaultValue) getInstances(String typeName, HashMap<PropertyFileHandleImpl.TypeData, Map<String, String>> lastRead) Returns the specific type associated with this handleprivate voidmodifyValues(WriteableBeanDatabase wbd, HashMap<PropertyFileHandleImpl.TypeData, Map<String, String>> allBeans) voidreadProperties(Properties properties) Reads the file associated with this handle and will do the following: Add any type found not previously added by this handle Add any instance found not previously added by this handle Modify any property that has changed value Remove any instance no longer seen in the file but that had previously been added In particular this method will NOT remove a type that was previously added but which has no more instances (other files may be contributing to the same type).private voidremoveInstances(WriteableBeanDatabase wbd, HashMap<PropertyFileHandleImpl.TypeData, Map<String, String>> allBeans)
-
Field Details
-
MAX_TRIES
private static final int MAX_TRIES- See Also:
-
SEPARATOR
private static final char SEPARATOR- See Also:
-
lock
-
lastRead
-
open
private boolean open -
specificType
-
defaultType
-
defaultInstanceName
-
hub
-
reflectionHelper
-
SET
-
-
Constructor Details
-
PropertyFileHandleImpl
-
-
Method Details
-
emptyNull
-
getDefaultType
-
getDefaultType
-
getDefaultInstance
-
addMultiValue
private static void addMultiValue(Map<PropertyFileHandleImpl.TypeData, Map<String, String>> buildMe, PropertyFileHandleImpl.TypeData key, String param, String value) -
extractData
-
removeInstances
private void removeInstances(WriteableBeanDatabase wbd, HashMap<PropertyFileHandleImpl.TypeData, Map<String, String>> allBeans) -
getPossibleSetterNames
-
findMethod
-
convertValue
-
convertBean
-
modifyValues
private void modifyValues(WriteableBeanDatabase wbd, HashMap<PropertyFileHandleImpl.TypeData, Map<String, String>> allBeans) -
addValues
private void addValues(WriteableBeanDatabase wbd, HashMap<PropertyFileHandleImpl.TypeData, Map<String, String>> allBeans) -
readProperties
Description copied from interface:PropertyFileHandleReads the file associated with this handle and will do the following:- Add any type found not previously added by this handle
- Add any instance found not previously added by this handle
- Modify any property that has changed value
- Remove any instance no longer seen in the file but that had previously been added
-
In particular this method will NOT remove a type that was previously added but
which has no more instances (other files may be contributing to the same type).
After reaching the end of the input stream this method will close it
- Specified by:
readPropertiesin interfacePropertyFileHandle- Parameters:
properties- The properties object to inspect. May not be null
-
getTypes
-
getInstances
-
getSpecificType
Description copied from interface:PropertyFileHandleReturns the specific type associated with this handle- Specified by:
getSpecificTypein interfacePropertyFileHandle- Returns:
- The specific type this handle is updating. May return null if this is a multi-type handle
-
getDefaultType
Description copied from interface:PropertyFileHandleReturns the default type name if the type cannot be determined from the key of the property. Will return null if getSpecificType is not null- Specified by:
getDefaultTypein interfacePropertyFileHandle- Returns:
- The default type name if the type cannot be determined, or null if this handle has a specific type
-
getDefaultInstanceName
Description copied from interface:PropertyFileHandleGets the default instance name that will be given to instances whose name cannot otherwise be determined- Specified by:
getDefaultInstanceNamein interfacePropertyFileHandle- Returns:
- The default instance name. Will not return null
-
dispose
public void dispose()Description copied from interface:PropertyFileHandleWill remove any instances added by this handle from the hub, and make it such that this handle can no longer be used- Specified by:
disposein interfacePropertyFileHandle
-