Class PropertyFileHandleImpl

    • Constructor Summary

      Constructors 
      Constructor Description
      PropertyFileHandleImpl​(java.lang.String specificType, java.lang.String defaultType, java.lang.String defaultInstanceName, Hub hub)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static void addMultiValue​(java.util.Map<PropertyFileHandleImpl.TypeData,​java.util.Map<java.lang.String,​java.lang.String>> buildMe, PropertyFileHandleImpl.TypeData key, java.lang.String param, java.lang.String value)  
      private void addValues​(WriteableBeanDatabase wbd, java.util.HashMap<PropertyFileHandleImpl.TypeData,​java.util.Map<java.lang.String,​java.lang.String>> allBeans)  
      private java.lang.Object convertBean​(java.lang.String typeName, java.util.Map<java.lang.String,​java.lang.String> rawBean)  
      private java.lang.Object convertValue​(java.lang.String value, java.lang.Class<?> intoMe)  
      void dispose()
      Will remove any instances added by this handle from the hub, and make it such that this handle can no longer be used
      private static java.lang.String emptyNull​(java.lang.String input)  
      private void extractData​(java.lang.String keyString, java.lang.String value, java.util.Map<PropertyFileHandleImpl.TypeData,​java.util.Map<java.lang.String,​java.lang.String>> buildMe)  
      private java.lang.reflect.Method findMethod​(java.lang.Class<?> clazz, java.util.Set<java.lang.String> possibleSetterNames)  
      private java.lang.String getDefaultInstance​(java.lang.String instanceString)  
      java.lang.String getDefaultInstanceName()
      Gets the default instance name that will be given to instances whose name cannot otherwise be determined
      java.lang.String getDefaultType()
      Returns the default type name if the type cannot be determined from the key of the property.
      private java.lang.String getDefaultType​(java.lang.String typeString)  
      private static java.lang.String getDefaultType​(java.lang.String typeString, java.lang.String defaultDefault, java.lang.String defaultValue)  
      private static java.util.HashSet<java.lang.String> getInstances​(java.lang.String typeName, java.util.HashMap<PropertyFileHandleImpl.TypeData,​java.util.Map<java.lang.String,​java.lang.String>> lastRead)  
      private static java.util.Set<java.lang.String> getPossibleSetterNames​(java.lang.String key)  
      java.lang.String getSpecificType()
      Returns the specific type associated with this handle
      private static java.util.HashSet<java.lang.String> getTypes​(java.util.HashMap<PropertyFileHandleImpl.TypeData,​java.util.Map<java.lang.String,​java.lang.String>> lastRead)  
      private void modifyValues​(WriteableBeanDatabase wbd, java.util.HashMap<PropertyFileHandleImpl.TypeData,​java.util.Map<java.lang.String,​java.lang.String>> allBeans)  
      void readProperties​(java.util.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 void removeInstances​(WriteableBeanDatabase wbd, java.util.HashMap<PropertyFileHandleImpl.TypeData,​java.util.Map<java.lang.String,​java.lang.String>> allBeans)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • lock

        private final java.lang.Object lock
      • open

        private boolean open
      • specificType

        private final java.lang.String specificType
      • defaultType

        private final java.lang.String defaultType
      • defaultInstanceName

        private final java.lang.String defaultInstanceName
      • hub

        private final Hub hub
      • SET

        private static java.lang.String SET
    • Constructor Detail

      • PropertyFileHandleImpl

        PropertyFileHandleImpl​(java.lang.String specificType,
                               java.lang.String defaultType,
                               java.lang.String defaultInstanceName,
                               Hub hub)
    • Method Detail

      • emptyNull

        private static java.lang.String emptyNull​(java.lang.String input)
      • getDefaultType

        private static java.lang.String getDefaultType​(java.lang.String typeString,
                                                       java.lang.String defaultDefault,
                                                       java.lang.String defaultValue)
      • getDefaultType

        private java.lang.String getDefaultType​(java.lang.String typeString)
      • getDefaultInstance

        private java.lang.String getDefaultInstance​(java.lang.String instanceString)
      • extractData

        private void extractData​(java.lang.String keyString,
                                 java.lang.String value,
                                 java.util.Map<PropertyFileHandleImpl.TypeData,​java.util.Map<java.lang.String,​java.lang.String>> buildMe)
      • getPossibleSetterNames

        private static java.util.Set<java.lang.String> getPossibleSetterNames​(java.lang.String key)
      • findMethod

        private java.lang.reflect.Method findMethod​(java.lang.Class<?> clazz,
                                                    java.util.Set<java.lang.String> possibleSetterNames)
      • convertValue

        private java.lang.Object convertValue​(java.lang.String value,
                                              java.lang.Class<?> intoMe)
      • convertBean

        private java.lang.Object convertBean​(java.lang.String typeName,
                                             java.util.Map<java.lang.String,​java.lang.String> rawBean)
      • readProperties

        public void readProperties​(java.util.Properties properties)
        Description copied from interface: PropertyFileHandle
        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). After reaching the end of the input stream this method will close it
        Specified by:
        readProperties in interface PropertyFileHandle
        Parameters:
        properties - The properties object to inspect. May not be null
      • getTypes

        private static java.util.HashSet<java.lang.String> getTypes​(java.util.HashMap<PropertyFileHandleImpl.TypeData,​java.util.Map<java.lang.String,​java.lang.String>> lastRead)
      • getInstances

        private static java.util.HashSet<java.lang.String> getInstances​(java.lang.String typeName,
                                                                        java.util.HashMap<PropertyFileHandleImpl.TypeData,​java.util.Map<java.lang.String,​java.lang.String>> lastRead)
      • getSpecificType

        public java.lang.String getSpecificType()
        Description copied from interface: PropertyFileHandle
        Returns the specific type associated with this handle
        Specified by:
        getSpecificType in interface PropertyFileHandle
        Returns:
        The specific type this handle is updating. May return null if this is a multi-type handle
      • getDefaultType

        public java.lang.String getDefaultType()
        Description copied from interface: PropertyFileHandle
        Returns 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:
        getDefaultType in interface PropertyFileHandle
        Returns:
        The default type name if the type cannot be determined, or null if this handle has a specific type
      • getDefaultInstanceName

        public java.lang.String getDefaultInstanceName()
        Description copied from interface: PropertyFileHandle
        Gets the default instance name that will be given to instances whose name cannot otherwise be determined
        Specified by:
        getDefaultInstanceName in interface PropertyFileHandle
        Returns:
        The default instance name. Will not return null
      • dispose

        public void dispose()
        Description copied from interface: PropertyFileHandle
        Will remove any instances added by this handle from the hub, and make it such that this handle can no longer be used
        Specified by:
        dispose in interface PropertyFileHandle