Interface PropertyFileService
-
- All Known Implementing Classes:
PropertyFileServiceImpl
@Contract public interface PropertyFileService
This service will read a java property file and add its contents to the HK2 configuration hub.The property file can have structured keys. If the property key has a dot in it (.) then the string before the dot is considered to be the name of the type. If there are two dots then the name of the instance is the string following the first dot and before the second dot. Anything after the second dot is the name of the property.
A specific type name can be given. If a specific type name is provided then the name prior to the first dot is considered the name of the instance, and everything after the first dot is the name of the property
A default name for instances of the type can be given. Any instance name provided in the property file will override the default instance name. The default default instance name is "DEFAULT"
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_INSTANCE_NAME
The default name for an instance if the instance name cannot be determinedstatic java.lang.String
DEFAULT_TYPE_NAME
The default name for a type if the type name cannot be determined
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addPropertyFileBean(PropertyFileBean propertyFileBean)
This is a utility method that will add the givenPropertyFileBean
to the Hub for use in configuring this servicePropertyFileHandle
createPropertyHandleOfAnyType()
Creates a PropertyFileHandle for reading an HK2 property file.PropertyFileHandle
createPropertyHandleOfAnyType(java.lang.String defaultTypeName, java.lang.String defaultInstanceName)
Creates a PropertyFileHandle for reading an HK2 property file.PropertyFileHandle
createPropertyHandleOfSpecificType(java.lang.String specificTypeName)
Creates a PropertyFileHandle for reading an HK2 property file that has a specific type name.PropertyFileHandle
createPropertyHandleOfSpecificType(java.lang.String specificTypeName, java.lang.String defaultInstanceName)
Creates a PropertyFileHandle for reading an HK2 property file that has a specific type name.void
removePropertyFileBean()
This is a utility method that will remove thePropertyFileBean
from the Hub if it is present
-
-
-
Field Detail
-
DEFAULT_INSTANCE_NAME
static final java.lang.String DEFAULT_INSTANCE_NAME
The default name for an instance if the instance name cannot be determined- See Also:
- Constant Field Values
-
DEFAULT_TYPE_NAME
static final java.lang.String DEFAULT_TYPE_NAME
The default name for a type if the type name cannot be determined- See Also:
- Constant Field Values
-
-
Method Detail
-
createPropertyHandleOfSpecificType
PropertyFileHandle createPropertyHandleOfSpecificType(java.lang.String specificTypeName, java.lang.String defaultInstanceName)
Creates a PropertyFileHandle for reading an HK2 property file that has a specific type name. This is generally used for property files that provide a specific set of instances for a single type. The default instance name will be set to the defaultInstanceName given- Parameters:
specificTypeName
- The non-null, non-empty string specific type name. All instances created or modified with this PropertyFileHandle will be in this typedefaultInstanceName
- The default name to give to instances of this type if the instance name cannot be determined. If null or the empty string then the default default instance of DEFAULT will be used- Returns:
- A non-null PropertyFileHandle that can be used to read the property file
-
createPropertyHandleOfSpecificType
PropertyFileHandle createPropertyHandleOfSpecificType(java.lang.String specificTypeName)
Creates a PropertyFileHandle for reading an HK2 property file that has a specific type name. This is generally used for property files that provide a specific set of instances for a single type- Parameters:
specificTypeName
- The non-null, non-empty string specific type name. All instances created or modified with this PropertyFileHandle will be in this type- Returns:
- A non-null PropertyFileHandle that can be used to read the property file
-
createPropertyHandleOfAnyType
PropertyFileHandle createPropertyHandleOfAnyType(java.lang.String defaultTypeName, java.lang.String defaultInstanceName)
Creates a PropertyFileHandle for reading an HK2 property file. This is used for property files that provide instances of multiple types within the same property file- Parameters:
defaultTypeName
- The default type name that will be used if a type name could not be determined. If null or empty the default type name of DEFAULT_TYPE will be useddefaultInstanceName
- The default name to give to instances of this type if the instance name cannot be determined. If null or the empty string then the default default instance of DEFAULT will be used- Returns:
- A non-null PropertyFileHandle that can be used to read the property file
-
createPropertyHandleOfAnyType
PropertyFileHandle createPropertyHandleOfAnyType()
Creates a PropertyFileHandle for reading an HK2 property file. This is used for property files that provide instances of multiple types within the same property file. Will use the default type name of DEFAULT_TYPE for types that cannot be determined and the default instance name of DEFAULT for instance names that cannot be determined- Returns:
- A non-null PropertyFileHandle that can be used to read the property file
-
addPropertyFileBean
void addPropertyFileBean(PropertyFileBean propertyFileBean)
This is a utility method that will add the givenPropertyFileBean
to the Hub for use in configuring this service- Parameters:
propertyFileBean
- The non-null property file bean that should either be added to the Hub or be used to modify the existing bean in the hub
-
removePropertyFileBean
void removePropertyFileBean()
This is a utility method that will remove thePropertyFileBean
from the Hub if it is present
-
-