Sapphire Developer Guide > Services


DependenciesService produces the set of model paths that point to parts of the model that the property depends on. A property listens on all of its dependencies and triggers refresh when any of the dependencies change.

Although custom implementations are supported, in most cases the supplied implementation that is configured via @DependsOn annotation should be sufficient.


@DependsOn( "Name" )

ValueProperty PROP_ID = new ValueProperty( TYPE, "Id" );

Value<String> getId();
void setId( String value );

Other annotations, such as @Unique can also inject implied dependencies (via their own DependenciesService implementations). For instance, placing @Unique annotation on a Name property automatically adds "#/Name" dependency.

If declarative approach is not sufficient, a custom DependenciesService implementation can be supplied.


public class CustomDependenciesService extends DependenciesService
    protected DependenciesServiceData compute()
        // Compute the list of dependencies.

        List<ModelPath> dependencies = new ArrayList<ModelPath>();


        return new DependenciesServiceData( dependencies );
@Service( impl = CustomDependenciesService.class )

ValueProperty PROP_NAME = new ValueProperty( TYPE, "Name" );

Value<String> getName();
void setName( String value );