de.smartics.properties.api.core.annotations
Annotation Type PropertyLifecycle


@Documented
@Target(value=METHOD)
@Retention(value=RUNTIME)
public @interface PropertyLifecycle

Defines the lifecycle of a property. This includes the time it is defined and updated.

To override the default read-only access type, use:

 
   
   

Example

@PropertySet("myprops")
public interface MyProperties {
...
  @PropertyLifecycle(access = AccessType.READ_WRITE)
  String name();
}


Optional Element Summary
 AccessType access
          Defines the access type of the property.
 PropertyDefinitionTime definitionTime
          Defines the time the property is configured with a value.
 long updateInterval
          Defines the interval within which a property must be checked for updates at runtime.
 

definitionTime

public abstract PropertyDefinitionTime definitionTime
Defines the time the property is configured with a value.

This value has only declarative meaning. It states that the property was designed to be configured at the given time. If a property is defined to be defined at PropertyDefinitionTime.DEPLOYMENT but is provisioned at PropertyDefinitionTime.STARTUP, the system's reaction is implementation dependent.

See Also:
PropertyDefinitionTime
Default:
de.smartics.properties.api.core.annotations.PropertyDefinitionTime.STARTUP

access

public abstract AccessType access
Defines the access type of the property.

Please note that some properties may not persist a change of a read-write property. If the property is read from a properties file on the class path, this property cannot be updated. The implementation of the de.smartics.properties.api.config.domain.ConfigurationProperties defines the strategy to handle such situations. Please consult the documentation of the selected implementation for details.

See Also:
AccessType
Default:
de.smartics.properties.api.core.annotations.AccessType.READ_ONLY

updateInterval

public abstract long updateInterval
Defines the interval within which a property must be checked for updates at runtime.

A value of zero indicates, that the property value must be checked on each access. A value smaller than zero means that the value is required to be read once and may be cached until the application is restarted. A value greater than zero shows the interval in milliseconds (ms) after the last read within which a value may be cached. It is not required that a value is actually read after that interval elapsed. It is only required that at the instance the value is requested and the interval has elapsed, the value must be read again and the cache is to be updated.

Per default a property is not automatically updated. If there is a need for automatic updates, it should be considered carefully, what the optimal update interval is.

Note:

Please note that this annotation field is related to access().

The following shows an example how to declare an update interval of 3 minutes:

@PropertyLifecycle(
      updateInterval = 3 * PropertyLifecycle.UpdateInterval#ONE_MINUTE)

Using static imports this can be reduced to:

@PropertyLifecycle(
      updateInterval = 3 * ONE_MINUTE)

See Also:
PropertyLifecycle.UpdateInterval
Default:
-1L


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.