target
stringlengths 20
113k
| src_fm
stringlengths 11
86.3k
| src_fm_fc
stringlengths 21
86.4k
| src_fm_fc_co
stringlengths 30
86.4k
| src_fm_fc_ms
stringlengths 42
86.8k
| src_fm_fc_ms_ff
stringlengths 43
86.8k
|
---|---|---|---|---|---|
@Test public void unzipNotAFile() throws IOException { ZipInputStream is = new ZipInputStream(new FileInputStream(TestCsars.VALID_LAMP_INPUT_TEMPLATE)); boolean result = ZipUtility.unzip(is, tmpdir.toString()); assertFalse(result); } | public static boolean unzip(ZipInputStream zipIn, String destDirectory) throws IOException { File destDir = new File(destDirectory); if (!destDir.exists()) { destDir.mkdir(); } ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { return false; } while (entry != null) { String filePath = destDirectory + File.separator + entry.getName(); if (!entry.isDirectory()) { extractFile(zipIn, filePath); } else { logger.trace("Creating directory: {}", filePath); File dir = new File(filePath); dir.mkdir(); } zipIn.closeEntry(); entry = zipIn.getNextEntry(); } zipIn.close(); return true; } | ZipUtility { public static boolean unzip(ZipInputStream zipIn, String destDirectory) throws IOException { File destDir = new File(destDirectory); if (!destDir.exists()) { destDir.mkdir(); } ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { return false; } while (entry != null) { String filePath = destDirectory + File.separator + entry.getName(); if (!entry.isDirectory()) { extractFile(zipIn, filePath); } else { logger.trace("Creating directory: {}", filePath); File dir = new File(filePath); dir.mkdir(); } zipIn.closeEntry(); entry = zipIn.getNextEntry(); } zipIn.close(); return true; } } | ZipUtility { public static boolean unzip(ZipInputStream zipIn, String destDirectory) throws IOException { File destDir = new File(destDirectory); if (!destDir.exists()) { destDir.mkdir(); } ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { return false; } while (entry != null) { String filePath = destDirectory + File.separator + entry.getName(); if (!entry.isDirectory()) { extractFile(zipIn, filePath); } else { logger.trace("Creating directory: {}", filePath); File dir = new File(filePath); dir.mkdir(); } zipIn.closeEntry(); entry = zipIn.getNextEntry(); } zipIn.close(); return true; } } | ZipUtility { public static boolean unzip(ZipInputStream zipIn, String destDirectory) throws IOException { File destDir = new File(destDirectory); if (!destDir.exists()) { destDir.mkdir(); } ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { return false; } while (entry != null) { String filePath = destDirectory + File.separator + entry.getName(); if (!entry.isDirectory()) { extractFile(zipIn, filePath); } else { logger.trace("Creating directory: {}", filePath); File dir = new File(filePath); dir.mkdir(); } zipIn.closeEntry(); entry = zipIn.getNextEntry(); } zipIn.close(); return true; } static boolean unzip(ZipInputStream zipIn, String destDirectory); static void compressDirectory(File directory, OutputStream output); } | ZipUtility { public static boolean unzip(ZipInputStream zipIn, String destDirectory) throws IOException { File destDir = new File(destDirectory); if (!destDir.exists()) { destDir.mkdir(); } ZipEntry entry = zipIn.getNextEntry(); if (entry == null) { return false; } while (entry != null) { String filePath = destDirectory + File.separator + entry.getName(); if (!entry.isDirectory()) { extractFile(zipIn, filePath); } else { logger.trace("Creating directory: {}", filePath); File dir = new File(filePath); dir.mkdir(); } zipIn.closeEntry(); entry = zipIn.getNextEntry(); } zipIn.close(); return true; } static boolean unzip(ZipInputStream zipIn, String destDirectory); static void compressDirectory(File directory, OutputStream output); } |
@Test public void copyFile() throws Exception { String filename = "testFile"; File file = new File(sourceDir, "testFile"); file.createNewFile(); File expectedFile = new File(targetDir, filename); assertFalse(expectedFile.exists()); access.copy(filename); assertTrue(expectedFile.exists()); } | public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test public void copyDirRecursively() throws IOException { String dirname = "dir"; File dir = new File(sourceDir, dirname); dir.mkdir(); for (int i = 0; i < 10; i++) { new File(dir, String.valueOf(i)).createNewFile(); } File expectedDir = new File(targetDir, dirname); assertFalse(expectedDir.exists()); access.copy(dirname); assertTrue(expectedDir.exists()); for (int i = 0; i < 10; i++) { assertTrue(new File(expectedDir, String.valueOf(i)).exists()); } } | public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test(expected = FileNotFoundException.class) public void copyInvalidPathThrowsException() throws IOException { String file = "nonexistent_file"; access.copy(file); } | public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test public void copySourceToGivenTargetSuccessful() throws IOException { String filename = "some-file"; File file = new File(sourceDir, filename); file.createNewFile(); String alternativeDirName = "some-dir/nested/even-deeper"; File alternateDirectory = new File(targetDir, alternativeDirName); File targetFile = new File(alternateDirectory, filename); String relativeTargetPath = String.format("%s/%s", alternativeDirName, filename); access.copy(filename, relativeTargetPath); assertTrue(targetFile.exists()); } | public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public void copy(String relativePath) throws IOException { copy(relativePath, relativePath); } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test public void testGetOutputs() throws Exception { List<Transformation> transformations = preInitNonCreationTests(); Transformation t = transformations.get(0); when(t.getState()).thenReturn(TransformationState.DONE); String outputKey = "test_output"; List<OutputProperty> outputs = Lists.newArrayList(new PlatformInput( outputKey, PropertyType.TEXT, "", true, "some value" )); when(t.getOutputs()).thenReturn(outputs); mvc.perform(get(GET_OUTPUT_URL)) .andDo(print()) .andExpect(status().is(200)) .andExpect(jsonPath("$.outputs").isArray()) .andExpect(jsonPath("$.links[0].href").value("http: .andExpect(jsonPath("$.outputs[0].key").value(outputKey)) .andReturn(); } | @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) public ResponseEntity<GetOutputsResponse> getOutputs( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); if (transformation.getState() != TransformationState.DONE && transformation.getState() != TransformationState.ERROR) { throw new IllegalTransformationStateException("The Transformation has not finished yet!"); } List<OutputProperty> outputs = transformation.getOutputs(); List<OutputWrap> wrappedOutputs = outputs.stream() .map(OutputWrap::new) .collect(Collectors.toList()); return ResponseEntity.ok(new GetOutputsResponse(csarId, platformId, wrappedOutputs)); } | TransformationController { @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) public ResponseEntity<GetOutputsResponse> getOutputs( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); if (transformation.getState() != TransformationState.DONE && transformation.getState() != TransformationState.ERROR) { throw new IllegalTransformationStateException("The Transformation has not finished yet!"); } List<OutputProperty> outputs = transformation.getOutputs(); List<OutputWrap> wrappedOutputs = outputs.stream() .map(OutputWrap::new) .collect(Collectors.toList()); return ResponseEntity.ok(new GetOutputsResponse(csarId, platformId, wrappedOutputs)); } } | TransformationController { @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) public ResponseEntity<GetOutputsResponse> getOutputs( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); if (transformation.getState() != TransformationState.DONE && transformation.getState() != TransformationState.ERROR) { throw new IllegalTransformationStateException("The Transformation has not finished yet!"); } List<OutputProperty> outputs = transformation.getOutputs(); List<OutputWrap> wrappedOutputs = outputs.stream() .map(OutputWrap::new) .collect(Collectors.toList()); return ResponseEntity.ok(new GetOutputsResponse(csarId, platformId, wrappedOutputs)); } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); } | TransformationController { @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) public ResponseEntity<GetOutputsResponse> getOutputs( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); if (transformation.getState() != TransformationState.DONE && transformation.getState() != TransformationState.ERROR) { throw new IllegalTransformationStateException("The Transformation has not finished yet!"); } List<OutputProperty> outputs = transformation.getOutputs(); List<OutputWrap> wrappedOutputs = outputs.stream() .map(OutputWrap::new) .collect(Collectors.toList()); return ResponseEntity.ok(new GetOutputsResponse(csarId, platformId, wrappedOutputs)); } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } | TransformationController { @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) public ResponseEntity<GetOutputsResponse> getOutputs( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); if (transformation.getState() != TransformationState.DONE && transformation.getState() != TransformationState.ERROR) { throw new IllegalTransformationStateException("The Transformation has not finished yet!"); } List<OutputProperty> outputs = transformation.getOutputs(); List<OutputWrap> wrappedOutputs = outputs.stream() .map(OutputWrap::new) .collect(Collectors.toList()); return ResponseEntity.ok(new GetOutputsResponse(csarId, platformId, wrappedOutputs)); } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } |
@Test public void write() throws Exception { String secondString = "second_test_string"; access.access(targetFileName).appendln(fileContent).close(); access.access(targetFileName).append(secondString).close(); assertTrue(targetFile.isFile()); List<String> result = IOUtils.readLines(new FileInputStream(targetFile)); assertEquals(fileContent, result.get(result.size() - 2)); assertEquals(secondString, result.get(result.size() - 1)); } | public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } | PluginFileAccess { public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } } | PluginFileAccess { public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test(expected = IOException.class) public void writePathIsDirectoryThrowsException() throws IOException { targetFile.mkdir(); access.access(targetFileName); } | public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } | PluginFileAccess { public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } } | PluginFileAccess { public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test public void writeSubDirectoriesGetAutomaticallyCreated() throws IOException { String path = "test/some/subdirs/filename"; access.access(path).append(fileContent).close(); File targetFile = new File(targetDir, path); assertTrue(targetFile.isFile()); assertEquals(fileContent, FileUtils.readFileToString(targetFile)); } | public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } | PluginFileAccess { public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } } | PluginFileAccess { public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public BufferedLineWriter access(String relativePath) throws IOException { File target = new File(targetDir, relativePath); target.getParentFile().mkdirs(); try { return new BufferedLineWriter(new FileWriter(target, true)); } catch (FileNotFoundException e) { logger.error("Failed to create OutputStream for file '{}'", target); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test public void readSuccessful() throws IOException { String path = "file"; File file = new File(sourceDir, path); InputStream inputStream = IOUtils.toInputStream(fileContent, "UTF-8"); FileUtils.copyInputStreamToFile(inputStream, file); String result = access.read(path); assertNotNull(result); assertEquals(fileContent, result); } | public String read(String relativePath) throws IOException { File source = new File(sourceDir, relativePath); try { return FileUtils.readFileToString(source); } catch (IOException e) { logger.error("Failed to read content from file '{}'", source); throw e; } } | PluginFileAccess { public String read(String relativePath) throws IOException { File source = new File(sourceDir, relativePath); try { return FileUtils.readFileToString(source); } catch (IOException e) { logger.error("Failed to read content from file '{}'", source); throw e; } } } | PluginFileAccess { public String read(String relativePath) throws IOException { File source = new File(sourceDir, relativePath); try { return FileUtils.readFileToString(source); } catch (IOException e) { logger.error("Failed to read content from file '{}'", source); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public String read(String relativePath) throws IOException { File source = new File(sourceDir, relativePath); try { return FileUtils.readFileToString(source); } catch (IOException e) { logger.error("Failed to read content from file '{}'", source); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public String read(String relativePath) throws IOException { File source = new File(sourceDir, relativePath); try { return FileUtils.readFileToString(source); } catch (IOException e) { logger.error("Failed to read content from file '{}'", source); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test(expected = IOException.class) public void readFileNotExists() throws IOException { String path = "nonexistent-file"; access.read(path); } | public String read(String relativePath) throws IOException { File source = new File(sourceDir, relativePath); try { return FileUtils.readFileToString(source); } catch (IOException e) { logger.error("Failed to read content from file '{}'", source); throw e; } } | PluginFileAccess { public String read(String relativePath) throws IOException { File source = new File(sourceDir, relativePath); try { return FileUtils.readFileToString(source); } catch (IOException e) { logger.error("Failed to read content from file '{}'", source); throw e; } } } | PluginFileAccess { public String read(String relativePath) throws IOException { File source = new File(sourceDir, relativePath); try { return FileUtils.readFileToString(source); } catch (IOException e) { logger.error("Failed to read content from file '{}'", source); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public String read(String relativePath) throws IOException { File source = new File(sourceDir, relativePath); try { return FileUtils.readFileToString(source); } catch (IOException e) { logger.error("Failed to read content from file '{}'", source); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public String read(String relativePath) throws IOException { File source = new File(sourceDir, relativePath); try { return FileUtils.readFileToString(source); } catch (IOException e) { logger.error("Failed to read content from file '{}'", source); throw e; } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test public void getAbsolutePathSuccess() throws IOException { String filename = "some-source-file"; File sourceFile = new File(targetDir, filename); sourceFile.createNewFile(); String result = access.getAbsolutePath(filename); assertEquals(sourceFile.getAbsolutePath(), result); } | public String getAbsolutePath(String relativePath) throws FileNotFoundException { File targetFile = new File(targetDir, relativePath); if (targetFile.exists()) { return targetFile.getAbsolutePath(); } else { throw new FileNotFoundException(String.format("File '%s' not found", targetFile)); } } | PluginFileAccess { public String getAbsolutePath(String relativePath) throws FileNotFoundException { File targetFile = new File(targetDir, relativePath); if (targetFile.exists()) { return targetFile.getAbsolutePath(); } else { throw new FileNotFoundException(String.format("File '%s' not found", targetFile)); } } } | PluginFileAccess { public String getAbsolutePath(String relativePath) throws FileNotFoundException { File targetFile = new File(targetDir, relativePath); if (targetFile.exists()) { return targetFile.getAbsolutePath(); } else { throw new FileNotFoundException(String.format("File '%s' not found", targetFile)); } } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public String getAbsolutePath(String relativePath) throws FileNotFoundException { File targetFile = new File(targetDir, relativePath); if (targetFile.exists()) { return targetFile.getAbsolutePath(); } else { throw new FileNotFoundException(String.format("File '%s' not found", targetFile)); } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public String getAbsolutePath(String relativePath) throws FileNotFoundException { File targetFile = new File(targetDir, relativePath); if (targetFile.exists()) { return targetFile.getAbsolutePath(); } else { throw new FileNotFoundException(String.format("File '%s' not found", targetFile)); } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test(expected = FileNotFoundException.class) public void getAbsolutePathNoSuchFile() throws FileNotFoundException { String filename = "nonexistent-file"; access.getAbsolutePath(filename); fail("getAbsolutePath() should have raised FileNotFoundException."); } | public String getAbsolutePath(String relativePath) throws FileNotFoundException { File targetFile = new File(targetDir, relativePath); if (targetFile.exists()) { return targetFile.getAbsolutePath(); } else { throw new FileNotFoundException(String.format("File '%s' not found", targetFile)); } } | PluginFileAccess { public String getAbsolutePath(String relativePath) throws FileNotFoundException { File targetFile = new File(targetDir, relativePath); if (targetFile.exists()) { return targetFile.getAbsolutePath(); } else { throw new FileNotFoundException(String.format("File '%s' not found", targetFile)); } } } | PluginFileAccess { public String getAbsolutePath(String relativePath) throws FileNotFoundException { File targetFile = new File(targetDir, relativePath); if (targetFile.exists()) { return targetFile.getAbsolutePath(); } else { throw new FileNotFoundException(String.format("File '%s' not found", targetFile)); } } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public String getAbsolutePath(String relativePath) throws FileNotFoundException { File targetFile = new File(targetDir, relativePath); if (targetFile.exists()) { return targetFile.getAbsolutePath(); } else { throw new FileNotFoundException(String.format("File '%s' not found", targetFile)); } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public String getAbsolutePath(String relativePath) throws FileNotFoundException { File targetFile = new File(targetDir, relativePath); if (targetFile.exists()) { return targetFile.getAbsolutePath(); } else { throw new FileNotFoundException(String.format("File '%s' not found", targetFile)); } } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test public void delete() throws IOException { String filename = "some-file"; File file = new File(targetDir, filename); file.createNewFile(); assertTrue(file.exists()); access.delete(filename); assertFalse(file.exists()); } | public void delete(String relativePath) { File file = new File(targetDir, relativePath); FileUtils.deleteQuietly(file); } | PluginFileAccess { public void delete(String relativePath) { File file = new File(targetDir, relativePath); FileUtils.deleteQuietly(file); } } | PluginFileAccess { public void delete(String relativePath) { File file = new File(targetDir, relativePath); FileUtils.deleteQuietly(file); } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public void delete(String relativePath) { File file = new File(targetDir, relativePath); FileUtils.deleteQuietly(file); } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public void delete(String relativePath) { File file = new File(targetDir, relativePath); FileUtils.deleteQuietly(file); } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test public void createFolder() { String folder = "some-folder/some-subfolder/some-subsubfolder"; access.createDirectories(folder); File expectedFolder = new File(targetDir, folder); assertTrue(expectedFolder.exists()); } | public void createDirectories(String relativePath) { File targetFolder = new File(targetDir, relativePath); targetFolder.mkdirs(); } | PluginFileAccess { public void createDirectories(String relativePath) { File targetFolder = new File(targetDir, relativePath); targetFolder.mkdirs(); } } | PluginFileAccess { public void createDirectories(String relativePath) { File targetFolder = new File(targetDir, relativePath); targetFolder.mkdirs(); } PluginFileAccess(File sourceDir, File targetDir, Log log); } | PluginFileAccess { public void createDirectories(String relativePath) { File targetFolder = new File(targetDir, relativePath); targetFolder.mkdirs(); } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } | PluginFileAccess { public void createDirectories(String relativePath) { File targetFolder = new File(targetDir, relativePath); targetFolder.mkdirs(); } PluginFileAccess(File sourceDir, File targetDir, Log log); void copy(String relativePath); void copy(String relativeSourcePath, String relativeTargetPath); BufferedLineWriter access(String relativePath); BufferedOutputStream accessAsOutputStream(String relativePath); String read(String relativePath); String getAbsolutePath(String relativePath); void delete(String relativePath); void createDirectories(String relativePath); } |
@Test public void getAllLogEntries() throws Exception { logger.info("Trying to retrieve complete log"); List<LogEntry> logs = log.getLogEntries(0); logger.info("Checking length"); assertTrue(logs.size() == 100); logger.info("Checking data"); for (int i = 0; i < logs.size(); i++) { LogEntry e = logs.get(i); assertEquals((String.format("Log-Message-%d", i)), e.getMessage()); } logger.info("Done"); } | @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); @Override void addLogEntry(LogEntry e); @Override List<LogEntry> getLogEntries(int first, int last); @Override List<LogEntry> getLogEntries(int firstIndex); @Override Logger getLogger(String context); @Override Logger getLogger(Class context); @Override void close(); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); @Override void addLogEntry(LogEntry e); @Override List<LogEntry> getLogEntries(int first, int last); @Override List<LogEntry> getLogEntries(int firstIndex); @Override Logger getLogger(String context); @Override Logger getLogger(Class context); @Override void close(); } |
@Test public void testGetOutputsEmptyOutputs() throws Exception { List<Transformation> transformations = preInitNonCreationTests(); Transformation t = transformations.get(0); when(t.getState()).thenReturn(TransformationState.DONE); when(t.getOutputs()).thenReturn(new ArrayList<>()); mvc.perform(get(GET_OUTPUT_URL)) .andDo(print()) .andExpect(status().is(200)) .andExpect(jsonPath("$.outputs").isArray()) .andExpect(jsonPath("$.links[0].href").value("http: .andReturn(); } | @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) public ResponseEntity<GetOutputsResponse> getOutputs( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); if (transformation.getState() != TransformationState.DONE && transformation.getState() != TransformationState.ERROR) { throw new IllegalTransformationStateException("The Transformation has not finished yet!"); } List<OutputProperty> outputs = transformation.getOutputs(); List<OutputWrap> wrappedOutputs = outputs.stream() .map(OutputWrap::new) .collect(Collectors.toList()); return ResponseEntity.ok(new GetOutputsResponse(csarId, platformId, wrappedOutputs)); } | TransformationController { @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) public ResponseEntity<GetOutputsResponse> getOutputs( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); if (transformation.getState() != TransformationState.DONE && transformation.getState() != TransformationState.ERROR) { throw new IllegalTransformationStateException("The Transformation has not finished yet!"); } List<OutputProperty> outputs = transformation.getOutputs(); List<OutputWrap> wrappedOutputs = outputs.stream() .map(OutputWrap::new) .collect(Collectors.toList()); return ResponseEntity.ok(new GetOutputsResponse(csarId, platformId, wrappedOutputs)); } } | TransformationController { @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) public ResponseEntity<GetOutputsResponse> getOutputs( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); if (transformation.getState() != TransformationState.DONE && transformation.getState() != TransformationState.ERROR) { throw new IllegalTransformationStateException("The Transformation has not finished yet!"); } List<OutputProperty> outputs = transformation.getOutputs(); List<OutputWrap> wrappedOutputs = outputs.stream() .map(OutputWrap::new) .collect(Collectors.toList()); return ResponseEntity.ok(new GetOutputsResponse(csarId, platformId, wrappedOutputs)); } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); } | TransformationController { @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) public ResponseEntity<GetOutputsResponse> getOutputs( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); if (transformation.getState() != TransformationState.DONE && transformation.getState() != TransformationState.ERROR) { throw new IllegalTransformationStateException("The Transformation has not finished yet!"); } List<OutputProperty> outputs = transformation.getOutputs(); List<OutputWrap> wrappedOutputs = outputs.stream() .map(OutputWrap::new) .collect(Collectors.toList()); return ResponseEntity.ok(new GetOutputsResponse(csarId, platformId, wrappedOutputs)); } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } | TransformationController { @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) public ResponseEntity<GetOutputsResponse> getOutputs( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); if (transformation.getState() != TransformationState.DONE && transformation.getState() != TransformationState.ERROR) { throw new IllegalTransformationStateException("The Transformation has not finished yet!"); } List<OutputProperty> outputs = transformation.getOutputs(); List<OutputWrap> wrappedOutputs = outputs.stream() .map(OutputWrap::new) .collect(Collectors.toList()); return ResponseEntity.ok(new GetOutputsResponse(csarId, platformId, wrappedOutputs)); } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } |
@Test public void getPartialLogEntries() throws Exception { logger.info("Trying to log from index 50"); List<LogEntry> logs = log.getLogEntries(50); logger.info("Checking length"); assertTrue(logs.size() == 50); logger.info("Checking data"); for (int i = 50; i < logs.size(); i++) { LogEntry e = logs.get(i); assertEquals(String.format("Log-Message-%d", i), e.getMessage()); } logger.info("Done"); } | @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); @Override void addLogEntry(LogEntry e); @Override List<LogEntry> getLogEntries(int first, int last); @Override List<LogEntry> getLogEntries(int firstIndex); @Override Logger getLogger(String context); @Override Logger getLogger(Class context); @Override void close(); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); @Override void addLogEntry(LogEntry e); @Override List<LogEntry> getLogEntries(int first, int last); @Override List<LogEntry> getLogEntries(int firstIndex); @Override Logger getLogger(String context); @Override Logger getLogger(Class context); @Override void close(); } |
@Test public void getLogsFromOuterBound() throws Exception { logger.info("Trying to get logs from index 100"); assertSame(0, log.getLogEntries(101).size()); logger.info("Done"); } | @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); @Override void addLogEntry(LogEntry e); @Override List<LogEntry> getLogEntries(int first, int last); @Override List<LogEntry> getLogEntries(int firstIndex); @Override Logger getLogger(String context); @Override Logger getLogger(Class context); @Override void close(); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); @Override void addLogEntry(LogEntry e); @Override List<LogEntry> getLogEntries(int first, int last); @Override List<LogEntry> getLogEntries(int firstIndex); @Override Logger getLogger(String context); @Override Logger getLogger(Class context); @Override void close(); } |
@Test public void getFirstTenLogEntries() throws Exception { logger.info("Trying to log from index 0 to 10"); List<LogEntry> logs = log.getLogEntries(0, 9); logger.info("Checking length"); assertSame(10, logs.size()); logger.info("Checking data"); for (int i = 0; i < logs.size(); i++) { LogEntry e = logs.get(i); assertEquals(String.format("Log-Message-%d", i), e.getMessage()); } logger.info("Done"); } | @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); @Override void addLogEntry(LogEntry e); @Override List<LogEntry> getLogEntries(int first, int last); @Override List<LogEntry> getLogEntries(int firstIndex); @Override Logger getLogger(String context); @Override Logger getLogger(Class context); @Override void close(); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); @Override void addLogEntry(LogEntry e); @Override List<LogEntry> getLogEntries(int first, int last); @Override List<LogEntry> getLogEntries(int firstIndex); @Override Logger getLogger(String context); @Override Logger getLogger(Class context); @Override void close(); } |
@Test(expected = IllegalArgumentException.class) public void getLogEntriesWithInvalidBounds() throws Exception { logger.info("Trying to log from index 0 to 10"); log.getLogEntries(100, 10); } | @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); @Override void addLogEntry(LogEntry e); @Override List<LogEntry> getLogEntries(int first, int last); @Override List<LogEntry> getLogEntries(int firstIndex); @Override Logger getLogger(String context); @Override Logger getLogger(Class context); @Override void close(); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); @Override void addLogEntry(LogEntry e); @Override List<LogEntry> getLogEntries(int first, int last); @Override List<LogEntry> getLogEntries(int firstIndex); @Override Logger getLogger(String context); @Override Logger getLogger(Class context); @Override void close(); } |
@Test public void logReadsLogfileWithIllegalLogsAndIgnoresThem() throws IOException { PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(logfile))); pw.write("log level which does not adhere to logging format"); log = new LogImpl(logfile); List<LogEntry> entries = log.getLogEntries(0); assertEquals(0, entries.size()); } | @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); @Override void addLogEntry(LogEntry e); @Override List<LogEntry> getLogEntries(int first, int last); @Override List<LogEntry> getLogEntries(int firstIndex); @Override Logger getLogger(String context); @Override Logger getLogger(Class context); @Override void close(); } | LogImpl implements Log { @Override public List<LogEntry> getLogEntries(int first, int last) { return getLogEntries(first, last, true); } LogImpl(File logFile); @Override void addLogEntry(LogEntry e); @Override List<LogEntry> getLogEntries(int first, int last); @Override List<LogEntry> getLogEntries(int firstIndex); @Override Logger getLogger(String context); @Override Logger getLogger(Class context); @Override void close(); } |
@Test(timeout = TEST_EXECUTION_TIMEOUT_MS) public void createTransformation() throws Exception { Transformation expected = new TransformationImpl(csar, PLATFORM1, log, modelMock()); Transformation transformation = service.createTransformation(csar, PLATFORM1); assertTrue(csar.getTransformation(PLATFORM1.id).isPresent()); assertEquals(expected, transformation); } | @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } |
@Test(timeout = TEST_EXECUTION_TIMEOUT_MS) public void transformationCreationNoProps() throws Exception { Transformation t = service.createTransformation(csar, PASSING_DUMMY.getPlatform()); assertTrue(csar.getTransformation(PASSING_DUMMY.getPlatform().id).isPresent()); assertNotNull(t); assertEquals(TransformationState.READY, t.getState()); } | @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } |
@Test(expected = PlatformNotFoundException.class) public void transformationCreationPlatformNotFound() throws PlatformNotFoundException { service.createTransformation(csar, PLATFORM_NOT_SUPPORTED); } | @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } |
@Test(timeout = TEST_EXECUTION_TIMEOUT_MS) public void transformationCreationInputNeeded() throws Exception { Transformation t = service.createTransformation(csar, PLATFORM_PASSING_INPUT_REQUIRED_DUMMY); assertTrue(csar.getTransformation(PLATFORM_PASSING_INPUT_REQUIRED_DUMMY.id).isPresent()); assertNotNull(t); assertEquals(TransformationState.INPUT_REQUIRED, t.getState()); } | @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } | TransformationServiceImpl implements TransformationService { @Override public Transformation createTransformation(Csar csar, Platform targetPlatform) throws PlatformNotFoundException { return transformationDao.create(csar, targetPlatform); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } |
@Test(timeout = TEST_EXECUTION_TIMEOUT_MS) public void startTransformation() throws Exception { Transformation t = startTransformationInternal(TransformationState.DONE, PASSING_DUMMY.getPlatform()); assertNotNull(t); } | @Override public boolean startTransformation(Transformation transformation) { if (transformation.getState() == TransformationState.READY) { Future<?> taskFuture = executor.submit( new ExecutionTask( transformation, artifactService, pluginService, csarDao.getContentDir(transformation.getCsar()), transformationDao.getContentDir(transformation) ) ); tasks.put(transformation, taskFuture); return true; } return false; } | TransformationServiceImpl implements TransformationService { @Override public boolean startTransformation(Transformation transformation) { if (transformation.getState() == TransformationState.READY) { Future<?> taskFuture = executor.submit( new ExecutionTask( transformation, artifactService, pluginService, csarDao.getContentDir(transformation.getCsar()), transformationDao.getContentDir(transformation) ) ); tasks.put(transformation, taskFuture); return true; } return false; } } | TransformationServiceImpl implements TransformationService { @Override public boolean startTransformation(Transformation transformation) { if (transformation.getState() == TransformationState.READY) { Future<?> taskFuture = executor.submit( new ExecutionTask( transformation, artifactService, pluginService, csarDao.getContentDir(transformation.getCsar()), transformationDao.getContentDir(transformation) ) ); tasks.put(transformation, taskFuture); return true; } return false; } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); } | TransformationServiceImpl implements TransformationService { @Override public boolean startTransformation(Transformation transformation) { if (transformation.getState() == TransformationState.READY) { Future<?> taskFuture = executor.submit( new ExecutionTask( transformation, artifactService, pluginService, csarDao.getContentDir(transformation.getCsar()), transformationDao.getContentDir(transformation) ) ); tasks.put(transformation, taskFuture); return true; } return false; } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } | TransformationServiceImpl implements TransformationService { @Override public boolean startTransformation(Transformation transformation) { if (transformation.getState() == TransformationState.READY) { Future<?> taskFuture = executor.submit( new ExecutionTask( transformation, artifactService, pluginService, csarDao.getContentDir(transformation.getCsar()), transformationDao.getContentDir(transformation) ) ); tasks.put(transformation, taskFuture); return true; } return false; } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } |
@Test public void testStartTransformationSuccess() throws Exception { preInitNonCreationTests(); when(transformationService.startTransformation(any(Transformation.class))).thenReturn(true); mvc.perform( post(START_TRANSFORMATION_VALID_URL) .contentType(MediaType.APPLICATION_JSON) .content(INPUTS_VALID) ).andDo(print()) .andExpect(status().is(200)) .andExpect(content().bytes(new byte[0])) .andReturn(); } | @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity startTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { logger.info("Starting transformation for csar '{}' on '{}'", name, platform); Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.startTransformation(transformation)) { return ResponseEntity.ok().build(); } else { throw new IllegalTransformationStateException("Transformation could not start because" + " its not in a valid state to start."); } } | TransformationController { @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity startTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { logger.info("Starting transformation for csar '{}' on '{}'", name, platform); Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.startTransformation(transformation)) { return ResponseEntity.ok().build(); } else { throw new IllegalTransformationStateException("Transformation could not start because" + " its not in a valid state to start."); } } } | TransformationController { @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity startTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { logger.info("Starting transformation for csar '{}' on '{}'", name, platform); Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.startTransformation(transformation)) { return ResponseEntity.ok().build(); } else { throw new IllegalTransformationStateException("Transformation could not start because" + " its not in a valid state to start."); } } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); } | TransformationController { @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity startTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { logger.info("Starting transformation for csar '{}' on '{}'", name, platform); Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.startTransformation(transformation)) { return ResponseEntity.ok().build(); } else { throw new IllegalTransformationStateException("Transformation could not start because" + " its not in a valid state to start."); } } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } | TransformationController { @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity startTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { logger.info("Starting transformation for csar '{}' on '{}'", name, platform); Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.startTransformation(transformation)) { return ResponseEntity.ok().build(); } else { throw new IllegalTransformationStateException("Transformation could not start because" + " its not in a valid state to start."); } } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } |
@Test(timeout = TEST_EXECUTION_TIMEOUT_MS) public void stopNotStarted() throws Exception { transformationCreationNoProps(); Transformation t = csar.getTransformations().get(PASSING_DUMMY.getPlatform().id); assertFalse(service.abortTransformation(t)); } | @Override public boolean abortTransformation(Transformation transformation) { Future<?> task = tasks.get(transformation); if (task == null) { return false; } if (task.isDone()) { return false; } return task.cancel(true); } | TransformationServiceImpl implements TransformationService { @Override public boolean abortTransformation(Transformation transformation) { Future<?> task = tasks.get(transformation); if (task == null) { return false; } if (task.isDone()) { return false; } return task.cancel(true); } } | TransformationServiceImpl implements TransformationService { @Override public boolean abortTransformation(Transformation transformation) { Future<?> task = tasks.get(transformation); if (task == null) { return false; } if (task.isDone()) { return false; } return task.cancel(true); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); } | TransformationServiceImpl implements TransformationService { @Override public boolean abortTransformation(Transformation transformation) { Future<?> task = tasks.get(transformation); if (task == null) { return false; } if (task.isDone()) { return false; } return task.cancel(true); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } | TransformationServiceImpl implements TransformationService { @Override public boolean abortTransformation(Transformation transformation) { Future<?> task = tasks.get(transformation); if (task == null) { return false; } if (task.isDone()) { return false; } return task.cancel(true); } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } |
@Test(timeout = TEST_EXECUTION_TIMEOUT_MS) public void deleteTransformation() throws Exception { Transformation transformation = new TransformationImpl(csar, PLATFORM1, log, modelMock()); csar.getTransformations().put(PLATFORM1.id, transformation); service.deleteTransformation(transformation); assertFalse(csar.getTransformations().containsValue(transformation)); } | @Override public boolean deleteTransformation(Transformation transformation) { if (transformation.getState() == TransformationState.TRANSFORMING) { return false; } transformationDao.delete(transformation); tasks.remove(transformation); return true; } | TransformationServiceImpl implements TransformationService { @Override public boolean deleteTransformation(Transformation transformation) { if (transformation.getState() == TransformationState.TRANSFORMING) { return false; } transformationDao.delete(transformation); tasks.remove(transformation); return true; } } | TransformationServiceImpl implements TransformationService { @Override public boolean deleteTransformation(Transformation transformation) { if (transformation.getState() == TransformationState.TRANSFORMING) { return false; } transformationDao.delete(transformation); tasks.remove(transformation); return true; } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); } | TransformationServiceImpl implements TransformationService { @Override public boolean deleteTransformation(Transformation transformation) { if (transformation.getState() == TransformationState.TRANSFORMING) { return false; } transformationDao.delete(transformation); tasks.remove(transformation); return true; } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } | TransformationServiceImpl implements TransformationService { @Override public boolean deleteTransformation(Transformation transformation) { if (transformation.getState() == TransformationState.TRANSFORMING) { return false; } transformationDao.delete(transformation); tasks.remove(transformation); return true; } @Autowired TransformationServiceImpl(
TransformationDao transformationDao,
PluginService pluginService,
@Lazy CsarDao csarDao,
ArtifactService artifactService
); @Override Transformation createTransformation(Csar csar, Platform targetPlatform); @Override boolean startTransformation(Transformation transformation); @Override boolean abortTransformation(Transformation transformation); @Override boolean deleteTransformation(Transformation transformation); } |
@Test public void getRootDir() { doReturn(new File(new File(tmpdir, csar.getIdentifier()), CsarFilesystemDao.TRANSFORMATION_DIR)).when(csarDao).getTransformationsDir(csar); doReturn(new File(tmpdir, csar.getIdentifier())).when(csarDao).getRootDir(csar); File expectedParent = new File(csarDao.getRootDir(csar), CsarFilesystemDao.TRANSFORMATION_DIR); File expected = new File(expectedParent, PLATFORM1.id); File actual = transformationDao.getRootDir(transformation); assertEquals(expected, actual); } | @Override public File getRootDir(Transformation transformation) { return getRootDir(transformation.getCsar(), transformation.getPlatform()); } | TransformationFilesystemDao implements TransformationDao { @Override public File getRootDir(Transformation transformation) { return getRootDir(transformation.getCsar(), transformation.getPlatform()); } } | TransformationFilesystemDao implements TransformationDao { @Override public File getRootDir(Transformation transformation) { return getRootDir(transformation.getCsar(), transformation.getPlatform()); } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); } | TransformationFilesystemDao implements TransformationDao { @Override public File getRootDir(Transformation transformation) { return getRootDir(transformation.getCsar(), transformation.getPlatform()); } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); @Override Transformation create(Csar csar, Platform platform); @Override void delete(Transformation transformation); @Override Optional<Transformation> find(Csar csar, Platform platform); @Override List<Transformation> find(Csar csar); @Override TargetArtifact createTargetArtifact(Transformation transformation); @Override File getRootDir(Transformation transformation); @Override File getContentDir(Transformation transformation); @Override void setCsarDao(CsarDao csarDao); } | TransformationFilesystemDao implements TransformationDao { @Override public File getRootDir(Transformation transformation) { return getRootDir(transformation.getCsar(), transformation.getPlatform()); } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); @Override Transformation create(Csar csar, Platform platform); @Override void delete(Transformation transformation); @Override Optional<Transformation> find(Csar csar, Platform platform); @Override List<Transformation> find(Csar csar); @Override TargetArtifact createTargetArtifact(Transformation transformation); @Override File getRootDir(Transformation transformation); @Override File getContentDir(Transformation transformation); @Override void setCsarDao(CsarDao csarDao); final static String ARTIFACT_FAILED_REGEX; final static String ARTIFACT_SUCCESSFUL_REGEX; final static String CONTENT_DIR; } |
@Test public void createDeletesOldFilesAndCreatesBlankDir() { List<File> files = createRandomFiles(transformationRootDir); assertNotEquals(0, transformationRootDir.list().length); when(platformService.isSupported(PLATFORM1)).thenReturn(true); transformationDao.create(csar, PLATFORM1); for (File file : files) { assertFalse(file.exists()); } assertTrue(transformationRootDir.exists()); File[] result = transformationRootDir.listFiles(); assertEquals(1, result.length); assertEquals(TransformationFilesystemDao.CONTENT_DIR, result[0].getName()); assertEquals(1, result[0].list().length); } | @Override public Transformation create(Csar csar, Platform platform) throws PlatformNotFoundException { if (!platformService.isSupported(platform)) { throw new PlatformNotFoundException(); } Optional<Transformation> oldTransformation = csar.getTransformation(platform.id); if (oldTransformation.isPresent()) { delete(oldTransformation.get()); } else { delete(getRootDir(csar, platform)); } Transformation transformation = createTransformation(csar, platform); csar.getTransformations().put(platform.id, transformation); getContentDir(transformation).mkdirs(); return transformation; } | TransformationFilesystemDao implements TransformationDao { @Override public Transformation create(Csar csar, Platform platform) throws PlatformNotFoundException { if (!platformService.isSupported(platform)) { throw new PlatformNotFoundException(); } Optional<Transformation> oldTransformation = csar.getTransformation(platform.id); if (oldTransformation.isPresent()) { delete(oldTransformation.get()); } else { delete(getRootDir(csar, platform)); } Transformation transformation = createTransformation(csar, platform); csar.getTransformations().put(platform.id, transformation); getContentDir(transformation).mkdirs(); return transformation; } } | TransformationFilesystemDao implements TransformationDao { @Override public Transformation create(Csar csar, Platform platform) throws PlatformNotFoundException { if (!platformService.isSupported(platform)) { throw new PlatformNotFoundException(); } Optional<Transformation> oldTransformation = csar.getTransformation(platform.id); if (oldTransformation.isPresent()) { delete(oldTransformation.get()); } else { delete(getRootDir(csar, platform)); } Transformation transformation = createTransformation(csar, platform); csar.getTransformations().put(platform.id, transformation); getContentDir(transformation).mkdirs(); return transformation; } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); } | TransformationFilesystemDao implements TransformationDao { @Override public Transformation create(Csar csar, Platform platform) throws PlatformNotFoundException { if (!platformService.isSupported(platform)) { throw new PlatformNotFoundException(); } Optional<Transformation> oldTransformation = csar.getTransformation(platform.id); if (oldTransformation.isPresent()) { delete(oldTransformation.get()); } else { delete(getRootDir(csar, platform)); } Transformation transformation = createTransformation(csar, platform); csar.getTransformations().put(platform.id, transformation); getContentDir(transformation).mkdirs(); return transformation; } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); @Override Transformation create(Csar csar, Platform platform); @Override void delete(Transformation transformation); @Override Optional<Transformation> find(Csar csar, Platform platform); @Override List<Transformation> find(Csar csar); @Override TargetArtifact createTargetArtifact(Transformation transformation); @Override File getRootDir(Transformation transformation); @Override File getContentDir(Transformation transformation); @Override void setCsarDao(CsarDao csarDao); } | TransformationFilesystemDao implements TransformationDao { @Override public Transformation create(Csar csar, Platform platform) throws PlatformNotFoundException { if (!platformService.isSupported(platform)) { throw new PlatformNotFoundException(); } Optional<Transformation> oldTransformation = csar.getTransformation(platform.id); if (oldTransformation.isPresent()) { delete(oldTransformation.get()); } else { delete(getRootDir(csar, platform)); } Transformation transformation = createTransformation(csar, platform); csar.getTransformations().put(platform.id, transformation); getContentDir(transformation).mkdirs(); return transformation; } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); @Override Transformation create(Csar csar, Platform platform); @Override void delete(Transformation transformation); @Override Optional<Transformation> find(Csar csar, Platform platform); @Override List<Transformation> find(Csar csar); @Override TargetArtifact createTargetArtifact(Transformation transformation); @Override File getRootDir(Transformation transformation); @Override File getContentDir(Transformation transformation); @Override void setCsarDao(CsarDao csarDao); final static String ARTIFACT_FAILED_REGEX; final static String ARTIFACT_SUCCESSFUL_REGEX; final static String CONTENT_DIR; } |
@Test public void delete() { createRandomFiles(transformationRootDir); transformationDao.delete(transformation); assertFalse(transformationRootDir.exists()); } | @Override public void delete(Transformation transformation) { transformation.getCsar().getTransformations().remove(transformation.getPlatform().id); File transformationDir = getRootDir(transformation); delete(transformationDir); } | TransformationFilesystemDao implements TransformationDao { @Override public void delete(Transformation transformation) { transformation.getCsar().getTransformations().remove(transformation.getPlatform().id); File transformationDir = getRootDir(transformation); delete(transformationDir); } } | TransformationFilesystemDao implements TransformationDao { @Override public void delete(Transformation transformation) { transformation.getCsar().getTransformations().remove(transformation.getPlatform().id); File transformationDir = getRootDir(transformation); delete(transformationDir); } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); } | TransformationFilesystemDao implements TransformationDao { @Override public void delete(Transformation transformation) { transformation.getCsar().getTransformations().remove(transformation.getPlatform().id); File transformationDir = getRootDir(transformation); delete(transformationDir); } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); @Override Transformation create(Csar csar, Platform platform); @Override void delete(Transformation transformation); @Override Optional<Transformation> find(Csar csar, Platform platform); @Override List<Transformation> find(Csar csar); @Override TargetArtifact createTargetArtifact(Transformation transformation); @Override File getRootDir(Transformation transformation); @Override File getContentDir(Transformation transformation); @Override void setCsarDao(CsarDao csarDao); } | TransformationFilesystemDao implements TransformationDao { @Override public void delete(Transformation transformation) { transformation.getCsar().getTransformations().remove(transformation.getPlatform().id); File transformationDir = getRootDir(transformation); delete(transformationDir); } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); @Override Transformation create(Csar csar, Platform platform); @Override void delete(Transformation transformation); @Override Optional<Transformation> find(Csar csar, Platform platform); @Override List<Transformation> find(Csar csar); @Override TargetArtifact createTargetArtifact(Transformation transformation); @Override File getRootDir(Transformation transformation); @Override File getContentDir(Transformation transformation); @Override void setCsarDao(CsarDao csarDao); final static String ARTIFACT_FAILED_REGEX; final static String ARTIFACT_SUCCESSFUL_REGEX; final static String CONTENT_DIR; } |
@Test public void findFromSpecificCsar() { when(csarDao.getTransformationsDir(csar)).thenReturn(tmpdir); createRandomFiles(new File(tmpdir, PLATFORM1.id)); createRandomFiles(new File(tmpdir, PLATFORM2.id)); createRandomFiles(new File(tmpdir, PLATFORM_NOT_SUPPORTED.id)); when(platformService.findPlatformById(PLATFORM1.id)).thenReturn(Optional.of(PLATFORM1)); when(platformService.findPlatformById(PLATFORM2.id)).thenReturn(Optional.of(PLATFORM2)); List<Transformation> transformations = transformationDao.find(csar); assertEquals(2, transformations.size()); } | @Override public Optional<Transformation> find(Csar csar, Platform platform) { Set<Transformation> transformations = readFromDisk(csar); return Optional.ofNullable(transformations.stream() .filter(transformation -> transformation.getCsar().equals(csar) && transformation.getPlatform().equals(platform)) .findFirst().orElse(null)); } | TransformationFilesystemDao implements TransformationDao { @Override public Optional<Transformation> find(Csar csar, Platform platform) { Set<Transformation> transformations = readFromDisk(csar); return Optional.ofNullable(transformations.stream() .filter(transformation -> transformation.getCsar().equals(csar) && transformation.getPlatform().equals(platform)) .findFirst().orElse(null)); } } | TransformationFilesystemDao implements TransformationDao { @Override public Optional<Transformation> find(Csar csar, Platform platform) { Set<Transformation> transformations = readFromDisk(csar); return Optional.ofNullable(transformations.stream() .filter(transformation -> transformation.getCsar().equals(csar) && transformation.getPlatform().equals(platform)) .findFirst().orElse(null)); } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); } | TransformationFilesystemDao implements TransformationDao { @Override public Optional<Transformation> find(Csar csar, Platform platform) { Set<Transformation> transformations = readFromDisk(csar); return Optional.ofNullable(transformations.stream() .filter(transformation -> transformation.getCsar().equals(csar) && transformation.getPlatform().equals(platform)) .findFirst().orElse(null)); } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); @Override Transformation create(Csar csar, Platform platform); @Override void delete(Transformation transformation); @Override Optional<Transformation> find(Csar csar, Platform platform); @Override List<Transformation> find(Csar csar); @Override TargetArtifact createTargetArtifact(Transformation transformation); @Override File getRootDir(Transformation transformation); @Override File getContentDir(Transformation transformation); @Override void setCsarDao(CsarDao csarDao); } | TransformationFilesystemDao implements TransformationDao { @Override public Optional<Transformation> find(Csar csar, Platform platform) { Set<Transformation> transformations = readFromDisk(csar); return Optional.ofNullable(transformations.stream() .filter(transformation -> transformation.getCsar().equals(csar) && transformation.getPlatform().equals(platform)) .findFirst().orElse(null)); } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); @Override Transformation create(Csar csar, Platform platform); @Override void delete(Transformation transformation); @Override Optional<Transformation> find(Csar csar, Platform platform); @Override List<Transformation> find(Csar csar); @Override TargetArtifact createTargetArtifact(Transformation transformation); @Override File getRootDir(Transformation transformation); @Override File getContentDir(Transformation transformation); @Override void setCsarDao(CsarDao csarDao); final static String ARTIFACT_FAILED_REGEX; final static String ARTIFACT_SUCCESSFUL_REGEX; final static String CONTENT_DIR; } |
@Test public void findSpecificTransformation() { when(csarDao.getTransformationsDir(csar)).thenReturn(tmpdir); when(platformService.findPlatformById(PLATFORM1.id)).thenReturn(Optional.of(PLATFORM1)); when(platformService.findPlatformById(PLATFORM2.id)).thenReturn(Optional.of(PLATFORM2)); createRandomFiles(new File(tmpdir, PLATFORM1.id)); createRandomFiles(new File(tmpdir, PLATFORM2.id)); Transformation transformation = transformationDao.find(csar, PLATFORM1).get(); assertNotNull(transformation); assertEquals(csar, transformation.getCsar()); assertEquals(PLATFORM1, transformation.getPlatform()); Optional<Transformation> notStoredTransformation = transformationDao.find(csar, PLATFORM3); assertFalse(notStoredTransformation.isPresent()); } | @Override public Optional<Transformation> find(Csar csar, Platform platform) { Set<Transformation> transformations = readFromDisk(csar); return Optional.ofNullable(transformations.stream() .filter(transformation -> transformation.getCsar().equals(csar) && transformation.getPlatform().equals(platform)) .findFirst().orElse(null)); } | TransformationFilesystemDao implements TransformationDao { @Override public Optional<Transformation> find(Csar csar, Platform platform) { Set<Transformation> transformations = readFromDisk(csar); return Optional.ofNullable(transformations.stream() .filter(transformation -> transformation.getCsar().equals(csar) && transformation.getPlatform().equals(platform)) .findFirst().orElse(null)); } } | TransformationFilesystemDao implements TransformationDao { @Override public Optional<Transformation> find(Csar csar, Platform platform) { Set<Transformation> transformations = readFromDisk(csar); return Optional.ofNullable(transformations.stream() .filter(transformation -> transformation.getCsar().equals(csar) && transformation.getPlatform().equals(platform)) .findFirst().orElse(null)); } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); } | TransformationFilesystemDao implements TransformationDao { @Override public Optional<Transformation> find(Csar csar, Platform platform) { Set<Transformation> transformations = readFromDisk(csar); return Optional.ofNullable(transformations.stream() .filter(transformation -> transformation.getCsar().equals(csar) && transformation.getPlatform().equals(platform)) .findFirst().orElse(null)); } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); @Override Transformation create(Csar csar, Platform platform); @Override void delete(Transformation transformation); @Override Optional<Transformation> find(Csar csar, Platform platform); @Override List<Transformation> find(Csar csar); @Override TargetArtifact createTargetArtifact(Transformation transformation); @Override File getRootDir(Transformation transformation); @Override File getContentDir(Transformation transformation); @Override void setCsarDao(CsarDao csarDao); } | TransformationFilesystemDao implements TransformationDao { @Override public Optional<Transformation> find(Csar csar, Platform platform) { Set<Transformation> transformations = readFromDisk(csar); return Optional.ofNullable(transformations.stream() .filter(transformation -> transformation.getCsar().equals(csar) && transformation.getPlatform().equals(platform)) .findFirst().orElse(null)); } @Autowired TransformationFilesystemDao(PlatformService platformService, EffectiveModelFactory effectiveModelFactory); @Override Transformation create(Csar csar, Platform platform); @Override void delete(Transformation transformation); @Override Optional<Transformation> find(Csar csar, Platform platform); @Override List<Transformation> find(Csar csar); @Override TargetArtifact createTargetArtifact(Transformation transformation); @Override File getRootDir(Transformation transformation); @Override File getContentDir(Transformation transformation); @Override void setCsarDao(CsarDao csarDao); final static String ARTIFACT_FAILED_REGEX; final static String ARTIFACT_SUCCESSFUL_REGEX; final static String CONTENT_DIR; } |
@Test public void getTransformationsForSpecificPlatform() throws Exception { Optional<Transformation> result = csar.getTransformation(PLATFORM1.id); assertTrue(result.isPresent()); assertEquals(transformation1, result.get()); } | @Override public Optional<Transformation> getTransformation(String platformId) { Transformation t = transformations.get(platformId); return Optional.ofNullable(t); } | CsarImpl implements Csar { @Override public Optional<Transformation> getTransformation(String platformId) { Transformation t = transformations.get(platformId); return Optional.ofNullable(t); } } | CsarImpl implements Csar { @Override public Optional<Transformation> getTransformation(String platformId) { Transformation t = transformations.get(platformId); return Optional.ofNullable(t); } CsarImpl(File rootDir, String identifier, Log log); } | CsarImpl implements Csar { @Override public Optional<Transformation> getTransformation(String platformId) { Transformation t = transformations.get(platformId); return Optional.ofNullable(t); } CsarImpl(File rootDir, String identifier, Log log); @Override boolean validate(); @Override Map<String, Transformation> getTransformations(); @Override Optional<Transformation> getTransformation(String platformId); @Override String getIdentifier(); @Override Log getLog(); @Override List<LifecyclePhase> getLifecyclePhases(); @Override LifecyclePhase getLifecyclePhase(Phase phase); @Override boolean equals(Object obj); @Override int hashCode(); @Override void setTransformations(List<Transformation> transformations); @Override File getContentDir(); @Override File getTemplate(); @Override String toString(); } | CsarImpl implements Csar { @Override public Optional<Transformation> getTransformation(String platformId) { Transformation t = transformations.get(platformId); return Optional.ofNullable(t); } CsarImpl(File rootDir, String identifier, Log log); @Override boolean validate(); @Override Map<String, Transformation> getTransformations(); @Override Optional<Transformation> getTransformation(String platformId); @Override String getIdentifier(); @Override Log getLog(); @Override List<LifecyclePhase> getLifecyclePhases(); @Override LifecyclePhase getLifecyclePhase(Phase phase); @Override boolean equals(Object obj); @Override int hashCode(); @Override void setTransformations(List<Transformation> transformations); @Override File getContentDir(); @Override File getTemplate(); @Override String toString(); } |
@Test public void create() throws Exception { String identifier = "my-csar-checkStateNoPropsSet"; File csarFile = TestCsars.VALID_MINIMAL_DOCKER; InputStream csarStream = new FileInputStream(csarFile); csarDao.create(identifier, csarStream); File csarFolder = new File(generalCsarsDir, identifier); File contentFolder = new File(csarFolder, CsarImpl.CONTENT_DIR); File transformationFolder = new File(csarFolder, CsarFilesystemDao.TRANSFORMATION_DIR); assertTrue(contentFolder.isDirectory()); assertTrue(transformationFolder.isDirectory()); assertTrue(contentFolder.list().length == 1); } | @Override public Csar create(String identifier, InputStream inputStream) { csarMap.remove(identifier); File csarDir = setupDir(identifier); Csar csar = new CsarImpl(getRootDir(identifier), identifier, getLog(identifier)); File transformationDir = new File(csarDir, TRANSFORMATION_DIR); transformationDir.mkdir(); unzip(identifier, inputStream, csar, csarDir); csarMap.put(identifier, csar); return csar; } | CsarFilesystemDao implements CsarDao { @Override public Csar create(String identifier, InputStream inputStream) { csarMap.remove(identifier); File csarDir = setupDir(identifier); Csar csar = new CsarImpl(getRootDir(identifier), identifier, getLog(identifier)); File transformationDir = new File(csarDir, TRANSFORMATION_DIR); transformationDir.mkdir(); unzip(identifier, inputStream, csar, csarDir); csarMap.put(identifier, csar); return csar; } } | CsarFilesystemDao implements CsarDao { @Override public Csar create(String identifier, InputStream inputStream) { csarMap.remove(identifier); File csarDir = setupDir(identifier); Csar csar = new CsarImpl(getRootDir(identifier), identifier, getLog(identifier)); File transformationDir = new File(csarDir, TRANSFORMATION_DIR); transformationDir.mkdir(); unzip(identifier, inputStream, csar, csarDir); csarMap.put(identifier, csar); return csar; } @Autowired CsarFilesystemDao(Preferences preferences, @Lazy TransformationDao transformationDao); } | CsarFilesystemDao implements CsarDao { @Override public Csar create(String identifier, InputStream inputStream) { csarMap.remove(identifier); File csarDir = setupDir(identifier); Csar csar = new CsarImpl(getRootDir(identifier), identifier, getLog(identifier)); File transformationDir = new File(csarDir, TRANSFORMATION_DIR); transformationDir.mkdir(); unzip(identifier, inputStream, csar, csarDir); csarMap.put(identifier, csar); return csar; } @Autowired CsarFilesystemDao(Preferences preferences, @Lazy TransformationDao transformationDao); @PostConstruct void init(); @Override Csar create(String identifier, InputStream inputStream); @Override void delete(String identifier); @Override Optional<Csar> find(String identifier); @Override List<Csar> findAll(); @Override File getRootDir(Csar csar); @Override File getContentDir(Csar csar); @Override File getTransformationsDir(Csar csar); } | CsarFilesystemDao implements CsarDao { @Override public Csar create(String identifier, InputStream inputStream) { csarMap.remove(identifier); File csarDir = setupDir(identifier); Csar csar = new CsarImpl(getRootDir(identifier), identifier, getLog(identifier)); File transformationDir = new File(csarDir, TRANSFORMATION_DIR); transformationDir.mkdir(); unzip(identifier, inputStream, csar, csarDir); csarMap.put(identifier, csar); return csar; } @Autowired CsarFilesystemDao(Preferences preferences, @Lazy TransformationDao transformationDao); @PostConstruct void init(); @Override Csar create(String identifier, InputStream inputStream); @Override void delete(String identifier); @Override Optional<Csar> find(String identifier); @Override List<Csar> findAll(); @Override File getRootDir(Csar csar); @Override File getContentDir(Csar csar); @Override File getTransformationsDir(Csar csar); final static String CSARS_DIR; final static String TRANSFORMATION_DIR; } |
@Test public void deleteCsarRemovesDataOnDisk() throws Exception { String identifier = createFakeCsarDirectories(1)[0]; csarDao.delete(identifier); File csarDir = new File(generalCsarsDir, identifier); assertFalse(csarDir.exists()); } | @Override public void delete(String identifier) { File csarDir = new File(dataDir, identifier); try { FileUtils.deleteDirectory(csarDir); csarMap.remove(identifier); logger.info("Deleted csar directory '{}'", csarDir); } catch (IOException e) { logger.error("Failed to delete csar directory with identifier '{}'", identifier, e); } } | CsarFilesystemDao implements CsarDao { @Override public void delete(String identifier) { File csarDir = new File(dataDir, identifier); try { FileUtils.deleteDirectory(csarDir); csarMap.remove(identifier); logger.info("Deleted csar directory '{}'", csarDir); } catch (IOException e) { logger.error("Failed to delete csar directory with identifier '{}'", identifier, e); } } } | CsarFilesystemDao implements CsarDao { @Override public void delete(String identifier) { File csarDir = new File(dataDir, identifier); try { FileUtils.deleteDirectory(csarDir); csarMap.remove(identifier); logger.info("Deleted csar directory '{}'", csarDir); } catch (IOException e) { logger.error("Failed to delete csar directory with identifier '{}'", identifier, e); } } @Autowired CsarFilesystemDao(Preferences preferences, @Lazy TransformationDao transformationDao); } | CsarFilesystemDao implements CsarDao { @Override public void delete(String identifier) { File csarDir = new File(dataDir, identifier); try { FileUtils.deleteDirectory(csarDir); csarMap.remove(identifier); logger.info("Deleted csar directory '{}'", csarDir); } catch (IOException e) { logger.error("Failed to delete csar directory with identifier '{}'", identifier, e); } } @Autowired CsarFilesystemDao(Preferences preferences, @Lazy TransformationDao transformationDao); @PostConstruct void init(); @Override Csar create(String identifier, InputStream inputStream); @Override void delete(String identifier); @Override Optional<Csar> find(String identifier); @Override List<Csar> findAll(); @Override File getRootDir(Csar csar); @Override File getContentDir(Csar csar); @Override File getTransformationsDir(Csar csar); } | CsarFilesystemDao implements CsarDao { @Override public void delete(String identifier) { File csarDir = new File(dataDir, identifier); try { FileUtils.deleteDirectory(csarDir); csarMap.remove(identifier); logger.info("Deleted csar directory '{}'", csarDir); } catch (IOException e) { logger.error("Failed to delete csar directory with identifier '{}'", identifier, e); } } @Autowired CsarFilesystemDao(Preferences preferences, @Lazy TransformationDao transformationDao); @PostConstruct void init(); @Override Csar create(String identifier, InputStream inputStream); @Override void delete(String identifier); @Override Optional<Csar> find(String identifier); @Override List<Csar> findAll(); @Override File getRootDir(Csar csar); @Override File getContentDir(Csar csar); @Override File getTransformationsDir(Csar csar); final static String CSARS_DIR; final static String TRANSFORMATION_DIR; } |
@Test public void testStartTransformationFail() throws Exception { preInitNonCreationTests(); when(transformationService.startTransformation(any(Transformation.class))).thenReturn(false); mvc.perform( post(START_TRANSFORMATION_VALID_URL) .contentType(MediaType.APPLICATION_JSON) .content(INPUTS_VALID) ).andDo(print()) .andExpect(status().is(400)) .andExpect(content().bytes(new byte[0])) .andReturn(); assertNotEquals(TransformationState.TRANSFORMING, csarService.getCsar(VALID_CSAR_NAME).get().getTransformation(VALID_PLATFORM_NAME).get().getState()); } | @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity startTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { logger.info("Starting transformation for csar '{}' on '{}'", name, platform); Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.startTransformation(transformation)) { return ResponseEntity.ok().build(); } else { throw new IllegalTransformationStateException("Transformation could not start because" + " its not in a valid state to start."); } } | TransformationController { @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity startTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { logger.info("Starting transformation for csar '{}' on '{}'", name, platform); Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.startTransformation(transformation)) { return ResponseEntity.ok().build(); } else { throw new IllegalTransformationStateException("Transformation could not start because" + " its not in a valid state to start."); } } } | TransformationController { @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity startTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { logger.info("Starting transformation for csar '{}' on '{}'", name, platform); Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.startTransformation(transformation)) { return ResponseEntity.ok().build(); } else { throw new IllegalTransformationStateException("Transformation could not start because" + " its not in a valid state to start."); } } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); } | TransformationController { @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity startTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { logger.info("Starting transformation for csar '{}' on '{}'", name, platform); Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.startTransformation(transformation)) { return ResponseEntity.ok().build(); } else { throw new IllegalTransformationStateException("Transformation could not start because" + " its not in a valid state to start."); } } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } | TransformationController { @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity startTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { logger.info("Starting transformation for csar '{}' on '{}'", name, platform); Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.startTransformation(transformation)) { return ResponseEntity.ok().build(); } else { throw new IllegalTransformationStateException("Transformation could not start because" + " its not in a valid state to start."); } } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } |
@Test public void find() { String identifier = createFakeCsarDirectories(1)[0]; csarDao = new CsarFilesystemDao(preferences, transformationDao); csarDao.init(); Optional<Csar> csar = csarDao.find(identifier); assertTrue(csar.isPresent()); assertEquals(identifier, csar.get().getIdentifier()); } | @Override public Optional<Csar> find(String identifier) { Csar csar = csarMap.get(identifier); return Optional.ofNullable(csar); } | CsarFilesystemDao implements CsarDao { @Override public Optional<Csar> find(String identifier) { Csar csar = csarMap.get(identifier); return Optional.ofNullable(csar); } } | CsarFilesystemDao implements CsarDao { @Override public Optional<Csar> find(String identifier) { Csar csar = csarMap.get(identifier); return Optional.ofNullable(csar); } @Autowired CsarFilesystemDao(Preferences preferences, @Lazy TransformationDao transformationDao); } | CsarFilesystemDao implements CsarDao { @Override public Optional<Csar> find(String identifier) { Csar csar = csarMap.get(identifier); return Optional.ofNullable(csar); } @Autowired CsarFilesystemDao(Preferences preferences, @Lazy TransformationDao transformationDao); @PostConstruct void init(); @Override Csar create(String identifier, InputStream inputStream); @Override void delete(String identifier); @Override Optional<Csar> find(String identifier); @Override List<Csar> findAll(); @Override File getRootDir(Csar csar); @Override File getContentDir(Csar csar); @Override File getTransformationsDir(Csar csar); } | CsarFilesystemDao implements CsarDao { @Override public Optional<Csar> find(String identifier) { Csar csar = csarMap.get(identifier); return Optional.ofNullable(csar); } @Autowired CsarFilesystemDao(Preferences preferences, @Lazy TransformationDao transformationDao); @PostConstruct void init(); @Override Csar create(String identifier, InputStream inputStream); @Override void delete(String identifier); @Override Optional<Csar> find(String identifier); @Override List<Csar> findAll(); @Override File getRootDir(Csar csar); @Override File getContentDir(Csar csar); @Override File getTransformationsDir(Csar csar); final static String CSARS_DIR; final static String TRANSFORMATION_DIR; } |
@Test public void findAll() { int numberOfCsars = 10; createFakeCsarDirectories(numberOfCsars); csarDao = new CsarFilesystemDao(preferences, transformationDao); csarDao.init(); List<Csar> csarList = csarDao.findAll(); assertEquals("Correct amount of csars returned", numberOfCsars, csarList.size()); } | @Override public List<Csar> findAll() { List<Csar> csarList = new ArrayList<>(); csarList.addAll(csarMap.values()); return csarList; } | CsarFilesystemDao implements CsarDao { @Override public List<Csar> findAll() { List<Csar> csarList = new ArrayList<>(); csarList.addAll(csarMap.values()); return csarList; } } | CsarFilesystemDao implements CsarDao { @Override public List<Csar> findAll() { List<Csar> csarList = new ArrayList<>(); csarList.addAll(csarMap.values()); return csarList; } @Autowired CsarFilesystemDao(Preferences preferences, @Lazy TransformationDao transformationDao); } | CsarFilesystemDao implements CsarDao { @Override public List<Csar> findAll() { List<Csar> csarList = new ArrayList<>(); csarList.addAll(csarMap.values()); return csarList; } @Autowired CsarFilesystemDao(Preferences preferences, @Lazy TransformationDao transformationDao); @PostConstruct void init(); @Override Csar create(String identifier, InputStream inputStream); @Override void delete(String identifier); @Override Optional<Csar> find(String identifier); @Override List<Csar> findAll(); @Override File getRootDir(Csar csar); @Override File getContentDir(Csar csar); @Override File getTransformationsDir(Csar csar); } | CsarFilesystemDao implements CsarDao { @Override public List<Csar> findAll() { List<Csar> csarList = new ArrayList<>(); csarList.addAll(csarMap.values()); return csarList; } @Autowired CsarFilesystemDao(Preferences preferences, @Lazy TransformationDao transformationDao); @PostConstruct void init(); @Override Csar create(String identifier, InputStream inputStream); @Override void delete(String identifier); @Override Optional<Csar> find(String identifier); @Override List<Csar> findAll(); @Override File getRootDir(Csar csar); @Override File getContentDir(Csar csar); @Override File getTransformationsDir(Csar csar); final static String CSARS_DIR; final static String TRANSFORMATION_DIR; } |
@Test public void requirementTest() { currentFile = REQUIREMENT; Optional<Entity> fulfiller = getGraph().getEntity(Lists.newArrayList("topology_template", "node_templates", "test-node", "requirements", "test-requirement1", "node")); assertTrue(fulfiller.isPresent()); Optional<Entity> fulfiller2 = getGraph().getEntity(Lists.newArrayList("topology_template", "node_templates", "test-node", "requirements", "test-requirement2", "node")); assertTrue(fulfiller2.isPresent()); MappingEntity capabilityEntity = (MappingEntity) getGraph().getEntity(new EntityId(Lists.newArrayList( "topology_template", "node_templates", "test-node", "requirements", "test-requirement2", "capability"))).get(); DatabaseEndpointCapability capability = TypeWrapper.wrapTypedElement(capabilityEntity); assertNotNull(capability); MappingEntity relationshipEntity = (MappingEntity) getGraph().getEntity(new EntityId(Lists.newArrayList( "topology_template", "node_templates", "test-node", "requirements", "test-requirement2", "relationship"))).get(); ConnectsTo relationship = TypeWrapper.wrapTypedElement(relationshipEntity); assertNotNull(relationship); assertEquals(Lists.newArrayList("1", "2"), getList("topology_template", "node_templates", "test-node", "requirements", "test-requirement2", "occurrences")); } | public Optional<Entity> getEntity(List<String> path) { Entity current = root; for (String segment : path) { Optional<Entity> child = current.getChild(segment); if (child.isPresent()) { current = child.get(); } else { return Optional.empty(); } } return Optional.of(current); } | ServiceGraph extends SimpleDirectedGraph<Entity, Connection> { public Optional<Entity> getEntity(List<String> path) { Entity current = root; for (String segment : path) { Optional<Entity> child = current.getChild(segment); if (child.isPresent()) { current = child.get(); } else { return Optional.empty(); } } return Optional.of(current); } } | ServiceGraph extends SimpleDirectedGraph<Entity, Connection> { public Optional<Entity> getEntity(List<String> path) { Entity current = root; for (String segment : path) { Optional<Entity> child = current.getChild(segment); if (child.isPresent()) { current = child.get(); } else { return Optional.empty(); } } return Optional.of(current); } ServiceGraph(Log log); ServiceGraph(File template, Log log); } | ServiceGraph extends SimpleDirectedGraph<Entity, Connection> { public Optional<Entity> getEntity(List<String> path) { Entity current = root; for (String segment : path) { Optional<Entity> child = current.getChild(segment); if (child.isPresent()) { current = child.get(); } else { return Optional.empty(); } } return Optional.of(current); } ServiceGraph(Log log); ServiceGraph(File template, Log log); void finalizeGraph(); boolean inputsValid(); Map<String, InputProperty> getInputs(); Map<String, OutputProperty> getOutputs(); void addEntity(Entity entity); Optional<Entity> getEntity(List<String> path); Optional<Entity> getEntity(EntityId id); Entity getEntityOrThrow(EntityId id); Iterator<Entity> iterator(EntityId id); void replaceEntity(Entity source, Entity target); void addConnection(Entity source, Entity target, String connectionName); Collection<Entity> getChildren(EntityId id); Logger getLogger(); Log getLog(); } | ServiceGraph extends SimpleDirectedGraph<Entity, Connection> { public Optional<Entity> getEntity(List<String> path) { Entity current = root; for (String segment : path) { Optional<Entity> child = current.getChild(segment); if (child.isPresent()) { current = child.get(); } else { return Optional.empty(); } } return Optional.of(current); } ServiceGraph(Log log); ServiceGraph(File template, Log log); void finalizeGraph(); boolean inputsValid(); Map<String, InputProperty> getInputs(); Map<String, OutputProperty> getOutputs(); void addEntity(Entity entity); Optional<Entity> getEntity(List<String> path); Optional<Entity> getEntity(EntityId id); Entity getEntityOrThrow(EntityId id); Iterator<Entity> iterator(EntityId id); void replaceEntity(Entity source, Entity target); void addConnection(Entity source, Entity target, String connectionName); Collection<Entity> getChildren(EntityId id); Logger getLogger(); Log getLog(); } |
@Test public void allInputsSetTest() { currentFile = INPUT_NO_VALUE; ServiceGraph graph = getGraph(); assertFalse(graph.inputsValid()); currentFile = INPUT; graph = getGraph(); assertTrue(graph.inputsValid()); } | public boolean inputsValid() { Map<String, InputProperty> inputs = getInputs(); return inputs.values().stream() .allMatch(InputProperty::isValid); } | ServiceGraph extends SimpleDirectedGraph<Entity, Connection> { public boolean inputsValid() { Map<String, InputProperty> inputs = getInputs(); return inputs.values().stream() .allMatch(InputProperty::isValid); } } | ServiceGraph extends SimpleDirectedGraph<Entity, Connection> { public boolean inputsValid() { Map<String, InputProperty> inputs = getInputs(); return inputs.values().stream() .allMatch(InputProperty::isValid); } ServiceGraph(Log log); ServiceGraph(File template, Log log); } | ServiceGraph extends SimpleDirectedGraph<Entity, Connection> { public boolean inputsValid() { Map<String, InputProperty> inputs = getInputs(); return inputs.values().stream() .allMatch(InputProperty::isValid); } ServiceGraph(Log log); ServiceGraph(File template, Log log); void finalizeGraph(); boolean inputsValid(); Map<String, InputProperty> getInputs(); Map<String, OutputProperty> getOutputs(); void addEntity(Entity entity); Optional<Entity> getEntity(List<String> path); Optional<Entity> getEntity(EntityId id); Entity getEntityOrThrow(EntityId id); Iterator<Entity> iterator(EntityId id); void replaceEntity(Entity source, Entity target); void addConnection(Entity source, Entity target, String connectionName); Collection<Entity> getChildren(EntityId id); Logger getLogger(); Log getLog(); } | ServiceGraph extends SimpleDirectedGraph<Entity, Connection> { public boolean inputsValid() { Map<String, InputProperty> inputs = getInputs(); return inputs.values().stream() .allMatch(InputProperty::isValid); } ServiceGraph(Log log); ServiceGraph(File template, Log log); void finalizeGraph(); boolean inputsValid(); Map<String, InputProperty> getInputs(); Map<String, OutputProperty> getOutputs(); void addEntity(Entity entity); Optional<Entity> getEntity(List<String> path); Optional<Entity> getEntity(EntityId id); Entity getEntityOrThrow(EntityId id); Iterator<Entity> iterator(EntityId id); void replaceEntity(Entity source, Entity target); void addConnection(Entity source, Entity target, String connectionName); Collection<Entity> getChildren(EntityId id); Logger getLogger(); Log getLog(); } |
@Test public void getInputsTest() throws Exception { preInitNonCreationTests(); MvcResult result = mvc.perform( get(INPUTS_VALID_URL) ).andDo(print()) .andExpect(status().is(200)) .andExpect(content().contentType(DEFAULT_CHARSET_HAL_JSON)) .andExpect(jsonPath("$.inputs").isArray()) .andExpect(jsonPath("$.inputs").isNotEmpty()) .andExpect(jsonPath("$.inputs[0].key").isString()) .andExpect(jsonPath("$.inputs[0].type").isString()) .andExpect(jsonPath("$.inputs[0].description").isString()) .andExpect(jsonPath("$.inputs[0].required").isBoolean()) .andExpect(jsonPath("$.links[0].rel").value("self")) .andExpect(jsonPath("$.links[0].href") .value("http: .andReturn(); MockHttpServletResponse response = result.getResponse(); String responseJson = new String(response.getContentAsByteArray()); String[] values = JsonPath.parse(responseJson).read("$.inputs[*].value", String[].class); long nullCount = Arrays.asList(values).stream().filter(Objects::isNull).count(); long testCount = Arrays.asList(values).stream().filter(e -> e != null && e.equals(INPUT_TEST_DEFAULT_VALUE)).count(); assertEquals(8, nullCount); assertEquals(1, testCount); } | @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<GetInputsResponse> getInputs( @ApiParam(value = "The identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); List<InputWrap> inputWrapList = toPropertyWrapList(transformation.getInputs(), null); GetInputsResponse response = new GetInputsResponse(csarId, platformId, inputWrapList); return ResponseEntity.ok(response); } | TransformationController { @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<GetInputsResponse> getInputs( @ApiParam(value = "The identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); List<InputWrap> inputWrapList = toPropertyWrapList(transformation.getInputs(), null); GetInputsResponse response = new GetInputsResponse(csarId, platformId, inputWrapList); return ResponseEntity.ok(response); } } | TransformationController { @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<GetInputsResponse> getInputs( @ApiParam(value = "The identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); List<InputWrap> inputWrapList = toPropertyWrapList(transformation.getInputs(), null); GetInputsResponse response = new GetInputsResponse(csarId, platformId, inputWrapList); return ResponseEntity.ok(response); } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); } | TransformationController { @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<GetInputsResponse> getInputs( @ApiParam(value = "The identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); List<InputWrap> inputWrapList = toPropertyWrapList(transformation.getInputs(), null); GetInputsResponse response = new GetInputsResponse(csarId, platformId, inputWrapList); return ResponseEntity.ok(response); } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } | TransformationController { @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<GetInputsResponse> getInputs( @ApiParam(value = "The identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); List<InputWrap> inputWrapList = toPropertyWrapList(transformation.getInputs(), null); GetInputsResponse response = new GetInputsResponse(csarId, platformId, inputWrapList); return ResponseEntity.ok(response); } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } |
@Test public void getInputsTest2() throws Exception { preInitNonCreationTests(); String inputKey = "secret_input"; String inputValue = "geheim"; csarService.getCsar(VALID_CSAR_NAME) .get().getTransformation(VALID_PLATFORM_NAME).get() .getInputs().set(inputKey, inputValue); MvcResult result = mvc.perform( get(INPUTS_VALID_URL) ).andDo(print()) .andExpect(status().is(200)) .andExpect(content().contentType(DEFAULT_CHARSET_HAL_JSON)) .andReturn(); JSONArray obj = new JSONObject(result.getResponse().getContentAsString()).getJSONArray("inputs"); boolean valueFound = false; boolean restNull = true; for (int i = 0; i < obj.length(); i++) { JSONObject content = obj.getJSONObject(i); if (content.getString("key").equals(inputKey)) { valueFound = content.getString("value").equals(inputValue); } else { restNull = restNull && (content.isNull("value") || content.getString("value").equals(INPUT_TEST_DEFAULT_VALUE)); } } assertTrue("Could not find valid value in property list", valueFound); assertTrue("Not all other values in property list are null or equal to the default value", restNull); } | @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<GetInputsResponse> getInputs( @ApiParam(value = "The identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); List<InputWrap> inputWrapList = toPropertyWrapList(transformation.getInputs(), null); GetInputsResponse response = new GetInputsResponse(csarId, platformId, inputWrapList); return ResponseEntity.ok(response); } | TransformationController { @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<GetInputsResponse> getInputs( @ApiParam(value = "The identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); List<InputWrap> inputWrapList = toPropertyWrapList(transformation.getInputs(), null); GetInputsResponse response = new GetInputsResponse(csarId, platformId, inputWrapList); return ResponseEntity.ok(response); } } | TransformationController { @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<GetInputsResponse> getInputs( @ApiParam(value = "The identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); List<InputWrap> inputWrapList = toPropertyWrapList(transformation.getInputs(), null); GetInputsResponse response = new GetInputsResponse(csarId, platformId, inputWrapList); return ResponseEntity.ok(response); } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); } | TransformationController { @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<GetInputsResponse> getInputs( @ApiParam(value = "The identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); List<InputWrap> inputWrapList = toPropertyWrapList(transformation.getInputs(), null); GetInputsResponse response = new GetInputsResponse(csarId, platformId, inputWrapList); return ResponseEntity.ok(response); } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } | TransformationController { @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<GetInputsResponse> getInputs( @ApiParam(value = "The identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String csarId, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platformId ) { Csar csar = findByCsarId(csarId); Transformation transformation = findTransformationByPlatform(csar, platformId); List<InputWrap> inputWrapList = toPropertyWrapList(transformation.getInputs(), null); GetInputsResponse response = new GetInputsResponse(csarId, platformId, inputWrapList); return ResponseEntity.ok(response); } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } |
@Test public void deleteTransformation() throws Exception { preInitNonCreationTests(); when(transformationService.deleteTransformation(any(Transformation.class))).thenReturn(true); mvc.perform( delete(DELETE_TRANSFORMATION_VALID_URL) ).andDo(print()) .andExpect(status().is(200)) .andReturn(); } | @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<Void> deleteTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.deleteTransformation(transformation)) { return ResponseEntity.ok().build(); } else { return ResponseEntity.status(400).build(); } } | TransformationController { @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<Void> deleteTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.deleteTransformation(transformation)) { return ResponseEntity.ok().build(); } else { return ResponseEntity.status(400).build(); } } } | TransformationController { @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<Void> deleteTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.deleteTransformation(transformation)) { return ResponseEntity.ok().build(); } else { return ResponseEntity.status(400).build(); } } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); } | TransformationController { @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<Void> deleteTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.deleteTransformation(transformation)) { return ResponseEntity.ok().build(); } else { return ResponseEntity.status(400).build(); } } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } | TransformationController { @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<Void> deleteTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.deleteTransformation(transformation)) { return ResponseEntity.ok().build(); } else { return ResponseEntity.status(400).build(); } } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } |
@Test public void deleteTransformationStillRunning() throws Exception { preInitNonCreationTests(); when(transformationService.deleteTransformation(any(Transformation.class))).thenReturn(false); mvc.perform( delete(DELETE_TRANSFORMATION_VALID_URL) ).andDo(print()) .andExpect(status().is(400)) .andReturn(); } | @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<Void> deleteTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.deleteTransformation(transformation)) { return ResponseEntity.ok().build(); } else { return ResponseEntity.status(400).build(); } } | TransformationController { @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<Void> deleteTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.deleteTransformation(transformation)) { return ResponseEntity.ok().build(); } else { return ResponseEntity.status(400).build(); } } } | TransformationController { @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<Void> deleteTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.deleteTransformation(transformation)) { return ResponseEntity.ok().build(); } else { return ResponseEntity.status(400).build(); } } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); } | TransformationController { @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<Void> deleteTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.deleteTransformation(transformation)) { return ResponseEntity.ok().build(); } else { return ResponseEntity.status(400).build(); } } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } | TransformationController { @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) public ResponseEntity<Void> deleteTransformation( @ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test") @PathVariable(name = "csarId") String name, @ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes") @PathVariable(name = "platform") String platform ) { Csar csar = findByCsarId(name); Transformation transformation = findTransformationByPlatform(csar, platform); if (transformationService.deleteTransformation(transformation)) { return ResponseEntity.ok().build(); } else { return ResponseEntity.status(400).build(); } } @Autowired TransformationController(CsarService csarService,
TransformationService transformationService,
PlatformService platformService); @RequestMapping( path = "", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "List all transformations of a CSAR", tags = {"transformations", "csars"}, notes = "Returns a HAL-Resources list containing all Transformations for a specific CSAR" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = TransformationResources.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier", response = RestErrorResponse.class ) }) ResponseEntity<Resources<TransformationResponse>> getCSARTransformations(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name
); @RequestMapping( path = "/{platform}", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get details for a specific transformation", tags = {"transformations"}, notes = "Returns a HAL-Resource Containing the details for the transformation with the given parameters" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<TransformationResponse> getCSARTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/create", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/hal+json" ) @ApiOperation( value = "Create a new Transformation", tags = {"transformations"}, notes = "Creates a new transformation for the given CSAR and Platform " + "(If the platform does not exist and there is no other transformation with the same CSAR and Platform, " + "you have to delete the old transformation in this case)" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The transfomation could not get created because there already is a Transformation" + " of this CSAR on the given Platform", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the platform is not known.", response = RestErrorResponse.class ) }) ResponseEntity<Void> addTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/start", method = RequestMethod.POST, produces = "application/hal+json" ) @ApiOperation( value = "Start a Transformation", tags = {"transformations"}, notes = "Starts a transformation that has been created and is ready to get started. To start a transformation, the " + "Transformation has to be in the state READY otherwise the transformation cannot start." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The state of the transformation is illegal. This means that the transformation is not in the" + "READY state. Therefore starting it is not possible", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity startTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/delete", method = RequestMethod.DELETE, produces = "application/hal+json" ) @ApiOperation( value = "Delete a transformation", tags = {"transformations"}, notes = "Deletes a transformation and all the coresponding artifacts" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "The Deletion of the csar failed", response = Void.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> deleteTransformation(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String name,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform
); @RequestMapping( path = "/{platform}/logs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Get the logs for a Transformation", tags = {"transformations"}, notes = "Returns the logs for a transformation, starting at a specific position. from the given start index all " + "following log lines get returned. If the start index is larger than the current last log index the operation " + "will return a empty list." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = LogResponse.class ), @ApiResponse( code = 400, message = "The given start value is less than zero", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<LogResponse> getTransformationLogs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@ApiParam(value = "The index of the first log entry you want (0 returns the whole log)", required = true, example = "0")
@RequestParam(name = "start", required = false, defaultValue = "0") Long start
); @RequestMapping( path = "/{platform}/artifact", method = RequestMethod.GET, produces = "application/octet-stream" ) @ApiOperation( value = "Download the target artifact archive", tags = {"transformations"}, notes = "Once the transformation is done (in the state DONE) or it has encountered a error (state ERROR). " + "It is possible to download a archive (ZIP format) of all the files generated while the transformation was " + "running." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully" ), @ApiResponse( code = 400, message = "There is nothing to download yet because the execution of the transformation has not yet started " + "or is not finished (With or without errors)", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<Void> getTransformationArtifact(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarName,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platform,
HttpServletResponse response
); @RequestMapping( path = "/{platform}/inputs", method = RequestMethod.GET, produces = "application/hal+json" ) @ApiOperation( value = "Retrieve the inputs of this transformation", tags = {"transformations"}, notes = "This Operation returns a list of inputs, specific to the csar and the platform. " + "If the input is invalid it has to be set in order to proceed with " + "starting the transformation. Setting the inputs is done with a POST or PUT to the same URL " + "(See Set Inputs Operation). If Transformation does not have any inputs, an empty array " + "is returned" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetInputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a Transformation for the specified platform.", response = RestErrorResponse.class ) }) ResponseEntity<GetInputsResponse> getInputs(
@ApiParam(value = "The identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @RequestMapping( path = "/{platform}/inputs", method = {RequestMethod.POST, RequestMethod.PUT}, produces = "application/json" ) @ApiOperation( value = "Set the value of inputs", tags = {"transformations"}, notes = "With this method it is possible to set the value of an input or multiple inputs at once. The values " + "of inputs can be set as long as they are in the READY or INPUT_REQUIRED state. The transformation changes its state " + "to ready once all required inputs have a valid value assigned to them." ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = Void.class ), @ApiResponse( code = 400, message = "Inputs cannot get set once the transformation has been started.", response = RestErrorResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform.", response = RestErrorResponse.class ), @ApiResponse( code = 406, message = "At least one of the inputs could not get set because either the key does not exist or the " + "syntax validation of the value has failed.", response = InputsResponse.class ) }) ResponseEntity<InputsResponse> setInputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId,
@RequestBody InputsResponse propertiesRequest
); @ApiOperation( value = "Retrieve the outputs and their values", tags = {"transformations"}, notes = "This operation returns the outputs of a deployment. Retrieval of the outputs is not possible " + "if the transformation (including deployment) is not done yet" ) @ApiResponses({ @ApiResponse( code = 200, message = "The operation was executed successfully", response = GetOutputsResponse.class ), @ApiResponse( code = 404, message = "There is no CSAR for the given identifier or the CSAR does not have " + "a transformation for the specified platform", response = RestErrorResponse.class ), @ApiResponse( code = 400, message = "The state of the transformation is invalid (not ERROR or DONE)", response = RestErrorResponse.class ) }) @RequestMapping( path = "/{platform}/outputs", method = {RequestMethod.GET}, produces = "application/hal+json" ) ResponseEntity<GetOutputsResponse> getOutputs(
@ApiParam(value = "The unique identifier for the CSAR", required = true, example = "test")
@PathVariable(name = "csarId") String csarId,
@ApiParam(value = "The identifier for the platform", required = true, example = "kubernetes")
@PathVariable(name = "platform") String platformId
); @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "Cannot delete csar with running transformations") @ExceptionHandler(IndexOutOfBoundsException.class) void handleLogIndexLessThanZero(); } |
@Test public void testGetUniqueName() { Set<String> names = Sets.newSet( "My Name A", "My Name B", "My Name B(1)", "My Name B(3)", "My Name C(1)", "My Name D_1", "My Name E (1)" ); assertEquals("My Name", NamingUtil.getUniqueName("My Name", names)); assertEquals("My Name", NamingUtil.getUniqueName(" My Name \t", names)); assertEquals("My Name a", NamingUtil.getUniqueName("My Name a", names)); assertEquals("My Name A(1)", NamingUtil.getUniqueName("My Name A", names)); assertEquals("My Name A(1)", NamingUtil.getUniqueName("My Name A(1)", names)); assertEquals("My Name A(01)", NamingUtil.getUniqueName("My Name A(01)", names)); assertEquals("My Name A_1", NamingUtil.getUniqueName("My Name A_1", names)); assertEquals("My Name B(2)", NamingUtil.getUniqueName("My Name B", names)); assertEquals("My Name B(4)", NamingUtil.getUniqueName("My Name B(3)", names)); assertEquals("My Name B(2)", NamingUtil.getUniqueName("My Name B(2)", names)); assertEquals("My Name C(2)", NamingUtil.getUniqueName("My Name C(1)", names)); assertEquals("My Name D", NamingUtil.getUniqueName("My Name D", names)); assertEquals("My Name D(1)", NamingUtil.getUniqueName("My Name D(1)", names)); assertEquals("My Name E (2)", NamingUtil.getUniqueName("My Name E (1)", names)); } | public static String getUniqueName(final String suggestedName, final Set<String> existingNames) { String name = suggestedName != null ? suggestedName.trim() : ""; if (name.isEmpty()) name = "UNDEFINED"; if (existingNames != null && !existingNames.isEmpty()) { if (!isNameTaken(name, existingNames)) return name; Matcher m = PATTERN.matcher(name); int start = 0; if (m.matches()) { name = name.substring(0, m.start(1) - 1); start = Integer.decode(m.group(1)); } for (int i = start; true; i++) { final String numberedName = name + "(" + (i + 1) + ")"; if (!isNameTaken(numberedName, existingNames)) return numberedName; } } return name; } | NamingUtil { public static String getUniqueName(final String suggestedName, final Set<String> existingNames) { String name = suggestedName != null ? suggestedName.trim() : ""; if (name.isEmpty()) name = "UNDEFINED"; if (existingNames != null && !existingNames.isEmpty()) { if (!isNameTaken(name, existingNames)) return name; Matcher m = PATTERN.matcher(name); int start = 0; if (m.matches()) { name = name.substring(0, m.start(1) - 1); start = Integer.decode(m.group(1)); } for (int i = start; true; i++) { final String numberedName = name + "(" + (i + 1) + ")"; if (!isNameTaken(numberedName, existingNames)) return numberedName; } } return name; } } | NamingUtil { public static String getUniqueName(final String suggestedName, final Set<String> existingNames) { String name = suggestedName != null ? suggestedName.trim() : ""; if (name.isEmpty()) name = "UNDEFINED"; if (existingNames != null && !existingNames.isEmpty()) { if (!isNameTaken(name, existingNames)) return name; Matcher m = PATTERN.matcher(name); int start = 0; if (m.matches()) { name = name.substring(0, m.start(1) - 1); start = Integer.decode(m.group(1)); } for (int i = start; true; i++) { final String numberedName = name + "(" + (i + 1) + ")"; if (!isNameTaken(numberedName, existingNames)) return numberedName; } } return name; } private NamingUtil(); } | NamingUtil { public static String getUniqueName(final String suggestedName, final Set<String> existingNames) { String name = suggestedName != null ? suggestedName.trim() : ""; if (name.isEmpty()) name = "UNDEFINED"; if (existingNames != null && !existingNames.isEmpty()) { if (!isNameTaken(name, existingNames)) return name; Matcher m = PATTERN.matcher(name); int start = 0; if (m.matches()) { name = name.substring(0, m.start(1) - 1); start = Integer.decode(m.group(1)); } for (int i = start; true; i++) { final String numberedName = name + "(" + (i + 1) + ")"; if (!isNameTaken(numberedName, existingNames)) return numberedName; } } return name; } private NamingUtil(); static String getUniqueName(final String suggestedName, final Set<String> existingNames); } | NamingUtil { public static String getUniqueName(final String suggestedName, final Set<String> existingNames) { String name = suggestedName != null ? suggestedName.trim() : ""; if (name.isEmpty()) name = "UNDEFINED"; if (existingNames != null && !existingNames.isEmpty()) { if (!isNameTaken(name, existingNames)) return name; Matcher m = PATTERN.matcher(name); int start = 0; if (m.matches()) { name = name.substring(0, m.start(1) - 1); start = Integer.decode(m.group(1)); } for (int i = start; true; i++) { final String numberedName = name + "(" + (i + 1) + ")"; if (!isNameTaken(numberedName, existingNames)) return numberedName; } } return name; } private NamingUtil(); static String getUniqueName(final String suggestedName, final Set<String> existingNames); } |
@Test public void testLinearNumberInterpolator() { LinearNumberInterpolator interpolator = new LinearNumberInterpolator(0.5, 1.0, 0.0, 5.0); assertDouble(0.0, interpolator.getRangeValue(0.5)); assertDouble(1.0, interpolator.getRangeValue(0.6)); assertDouble(2.0, interpolator.getRangeValue(0.7)); assertDouble(3.0, interpolator.getRangeValue(0.8)); assertDouble(4.0, interpolator.getRangeValue(0.9)); assertDouble(5.0, interpolator.getRangeValue(1.0)); assertDouble(-1.0, interpolator.getRangeValue(0.4)); assertDouble(6.0, interpolator.getRangeValue(1.1)); } | public LinearNumberInterpolator(double lowerDomain, double upperDomain, double lowerRange, double upperRange) { this.lowerDomain = lowerDomain; this.lowerRange = lowerRange; this.upperDomain = upperDomain; this.upperRange = upperRange; } | LinearNumberInterpolator { public LinearNumberInterpolator(double lowerDomain, double upperDomain, double lowerRange, double upperRange) { this.lowerDomain = lowerDomain; this.lowerRange = lowerRange; this.upperDomain = upperDomain; this.upperRange = upperRange; } } | LinearNumberInterpolator { public LinearNumberInterpolator(double lowerDomain, double upperDomain, double lowerRange, double upperRange) { this.lowerDomain = lowerDomain; this.lowerRange = lowerRange; this.upperDomain = upperDomain; this.upperRange = upperRange; } LinearNumberInterpolator(double lowerDomain, double upperDomain, double lowerRange, double upperRange); } | LinearNumberInterpolator { public LinearNumberInterpolator(double lowerDomain, double upperDomain, double lowerRange, double upperRange) { this.lowerDomain = lowerDomain; this.lowerRange = lowerRange; this.upperDomain = upperDomain; this.upperRange = upperRange; } LinearNumberInterpolator(double lowerDomain, double upperDomain, double lowerRange, double upperRange); double getRangeValue(double domainValue); LinearNumberInterpolator withDomainCutoff(final double lowerValue, final double upperValue); } | LinearNumberInterpolator { public LinearNumberInterpolator(double lowerDomain, double upperDomain, double lowerRange, double upperRange) { this.lowerDomain = lowerDomain; this.lowerRange = lowerRange; this.upperDomain = upperDomain; this.upperRange = upperRange; } LinearNumberInterpolator(double lowerDomain, double upperDomain, double lowerRange, double upperRange); double getRangeValue(double domainValue); LinearNumberInterpolator withDomainCutoff(final double lowerValue, final double upperValue); } |
@Test public void testPathUtil() { { Path c = PathUtil.commonRoot(plist("/a/b/c", "/a/b/d")); assertEquals(Paths.get("/a/b"), c); } { Path c = PathUtil.commonRoot(plist("/a/b/c/d/e", "/a/b/c/x/y", "/a/b/q/w")); assertEquals(Paths.get("/a/b"), c); } { Path c = PathUtil.commonRoot(plist("/x/y/z", "/a/b/d")); assertEquals(Paths.get("/"), c); } { Path c = PathUtil.commonRoot(plist("/", "/a/b/d")); assertEquals(Paths.get("/"), c); } { Path c = PathUtil.commonRoot(plist("/x/y/z", "a/b/d")); assertNull(c); } { Path c = PathUtil.commonRoot(plist("/x/y/z", null)); assertNull(c); } } | private PathUtil() {} | PathUtil { private PathUtil() {} } | PathUtil { private PathUtil() {} private PathUtil(); } | PathUtil { private PathUtil() {} private PathUtil(); static List<Path> dataSetsRoots(Collection<DataSetParameters> dataSets); static Path commonRoot(List<Path> paths); static Path commonRoot(Path p1, Path p2); } | PathUtil { private PathUtil() {} private PathUtil(); static List<Path> dataSetsRoots(Collection<DataSetParameters> dataSets); static Path commonRoot(List<Path> paths); static Path commonRoot(Path p1, Path p2); } |
@Test public void testSimilarityKey() { SimilarityKey k1 = new SimilarityKey("A", "B", "i", null); SimilarityKey k1p = new SimilarityKey("A", "B", "i", null); SimilarityKey k2 = new SimilarityKey("B", "A", "i", null); SimilarityKey k3 = new SimilarityKey("D", "C", "x", null); SimilarityKey k4 = new SimilarityKey("A", "B", "x", null); assertEquals(k1, k1); assertEquals(k1, k1p); assertEquals(k1, k2); assertEquals(k2, k1); assertNotEquals(k1, k3); assertNotEquals(k1, k4); Set<SimilarityKey> keys = new HashSet<>(); Collections.addAll(keys, k1, k1p, k2, k3); assertEquals(2, keys.size()); } | public SimilarityKey(String geneSet1, String geneSet2, String interaction, String name) { Objects.requireNonNull(geneSet1); Objects.requireNonNull(interaction); Objects.requireNonNull(geneSet2); this.geneSet1 = geneSet1; this.geneSet2 = geneSet2; this.interaction = interaction; this.name = name; } | SimilarityKey { public SimilarityKey(String geneSet1, String geneSet2, String interaction, String name) { Objects.requireNonNull(geneSet1); Objects.requireNonNull(interaction); Objects.requireNonNull(geneSet2); this.geneSet1 = geneSet1; this.geneSet2 = geneSet2; this.interaction = interaction; this.name = name; } } | SimilarityKey { public SimilarityKey(String geneSet1, String geneSet2, String interaction, String name) { Objects.requireNonNull(geneSet1); Objects.requireNonNull(interaction); Objects.requireNonNull(geneSet2); this.geneSet1 = geneSet1; this.geneSet2 = geneSet2; this.interaction = interaction; this.name = name; } SimilarityKey(String geneSet1, String geneSet2, String interaction, String name); } | SimilarityKey { public SimilarityKey(String geneSet1, String geneSet2, String interaction, String name) { Objects.requireNonNull(geneSet1); Objects.requireNonNull(interaction); Objects.requireNonNull(geneSet2); this.geneSet1 = geneSet1; this.geneSet2 = geneSet2; this.interaction = interaction; this.name = name; } SimilarityKey(String geneSet1, String geneSet2, String interaction, String name); String getGeneSet1(); String getGeneSet2(); String getInteraction(); boolean isCompound(); String getName(); @Override int hashCode(); @Override boolean equals(Object o); String getCompoundName(); @Override String toString(); } | SimilarityKey { public SimilarityKey(String geneSet1, String geneSet2, String interaction, String name) { Objects.requireNonNull(geneSet1); Objects.requireNonNull(interaction); Objects.requireNonNull(geneSet2); this.geneSet1 = geneSet1; this.geneSet2 = geneSet2; this.interaction = interaction; this.name = name; } SimilarityKey(String geneSet1, String geneSet2, String interaction, String name); String getGeneSet1(); String getGeneSet2(); String getInteraction(); boolean isCompound(); String getName(); @Override int hashCode(); @Override boolean equals(Object o); String getCompoundName(); @Override String toString(); final String geneSet1; final String geneSet2; final String interaction; final String name; } |
@Test public void testSimilarityKeyHashCode() { SimilarityKey k1 = new SimilarityKey("A", "B", "i", null); SimilarityKey k1p = new SimilarityKey("A", "B", "i", null); SimilarityKey k2 = new SimilarityKey("B", "A", "i", null); SimilarityKey k3 = new SimilarityKey("D", "C", "x", null); SimilarityKey k4 = new SimilarityKey("A", "B", "x", null); assertEquals(k1.hashCode(), k1p.hashCode()); assertEquals(k1.hashCode(), k2.hashCode()); assertEquals(k2.hashCode(), k1.hashCode()); assertNotEquals(k1.hashCode(), k3.hashCode()); assertNotEquals(k1.hashCode(), k4.hashCode()); } | @Override public int hashCode() { return Objects.hash(geneSet1.hashCode() + geneSet2.hashCode(), interaction, name); } | SimilarityKey { @Override public int hashCode() { return Objects.hash(geneSet1.hashCode() + geneSet2.hashCode(), interaction, name); } } | SimilarityKey { @Override public int hashCode() { return Objects.hash(geneSet1.hashCode() + geneSet2.hashCode(), interaction, name); } SimilarityKey(String geneSet1, String geneSet2, String interaction, String name); } | SimilarityKey { @Override public int hashCode() { return Objects.hash(geneSet1.hashCode() + geneSet2.hashCode(), interaction, name); } SimilarityKey(String geneSet1, String geneSet2, String interaction, String name); String getGeneSet1(); String getGeneSet2(); String getInteraction(); boolean isCompound(); String getName(); @Override int hashCode(); @Override boolean equals(Object o); String getCompoundName(); @Override String toString(); } | SimilarityKey { @Override public int hashCode() { return Objects.hash(geneSet1.hashCode() + geneSet2.hashCode(), interaction, name); } SimilarityKey(String geneSet1, String geneSet2, String interaction, String name); String getGeneSet1(); String getGeneSet2(); String getInteraction(); boolean isCompound(); String getName(); @Override int hashCode(); @Override boolean equals(Object o); String getCompoundName(); @Override String toString(); final String geneSet1; final String geneSet2; final String interaction; final String name; } |
@Test public void testSimilarityKeyToString() { SimilarityKey k1 = new SimilarityKey("A", "B", "i", null); SimilarityKey k2 = new SimilarityKey("A", "B", "i", "1"); SimilarityKey k3 = new SimilarityKey("A", "B", "i", "2"); assertEquals("A (i) B", k1.toString()); assertEquals("A (i_1) B", k2.toString()); assertEquals("A (i_2) B", k3.toString()); } | @Override public String toString() { return isCompound() ? getCompoundName() : String.format("%s (%s_%s) %s", geneSet1, interaction, name, geneSet2); } | SimilarityKey { @Override public String toString() { return isCompound() ? getCompoundName() : String.format("%s (%s_%s) %s", geneSet1, interaction, name, geneSet2); } } | SimilarityKey { @Override public String toString() { return isCompound() ? getCompoundName() : String.format("%s (%s_%s) %s", geneSet1, interaction, name, geneSet2); } SimilarityKey(String geneSet1, String geneSet2, String interaction, String name); } | SimilarityKey { @Override public String toString() { return isCompound() ? getCompoundName() : String.format("%s (%s_%s) %s", geneSet1, interaction, name, geneSet2); } SimilarityKey(String geneSet1, String geneSet2, String interaction, String name); String getGeneSet1(); String getGeneSet2(); String getInteraction(); boolean isCompound(); String getName(); @Override int hashCode(); @Override boolean equals(Object o); String getCompoundName(); @Override String toString(); } | SimilarityKey { @Override public String toString() { return isCompound() ? getCompoundName() : String.format("%s (%s_%s) %s", geneSet1, interaction, name, geneSet2); } SimilarityKey(String geneSet1, String geneSet2, String interaction, String name); String getGeneSet1(); String getGeneSet2(); String getInteraction(); boolean isCompound(); String getName(); @Override int hashCode(); @Override boolean equals(Object o); String getCompoundName(); @Override String toString(); final String geneSet1; final String geneSet2; final String interaction; final String name; } |
@Test public void testPathwayCommonsTask( CyNetworkManager networkManager, OpenBrowser openBrowser, PropertyManager propertyManager, OpenPathwayCommonsTask.Factory pathwayCommonsTaskFactory ) { CyNetwork network = networkManager.getNetwork(map.getNetworkID()); CyNode node = TestUtils.getNodes(network).get("TOP1_PLUS100"); propertyManager.setValue(PropertyManager.PATHWAY_COMMONS_URL, "http: @SuppressWarnings("deprecation") String returnUri = URLEncoder.encode("http: String expectedUri = "http: OpenPathwayCommonsTask task = pathwayCommonsTaskFactory.create(network, node); String uri = task.getPathwayCommonsURL(); assertEquals(expectedUri, uri); } | public String getPathwayCommonsURL() { EnrichmentMap map = emManager.getEnrichmentMap(network.getSUID()); if(map == null) return null; int port = Integer.parseInt(cy3props.getProperties().getProperty("rest.port")); String pcBaseUri = propertyManager.getValue(PropertyManager.PATHWAY_COMMONS_URL); String nodeLabel = getNodeLabel(map); try { String returnPath; if(node == null) returnPath = "/enrichmentmap/expressions/heatmap"; else returnPath = String.format("/enrichmentmap/expressions/%s/%s", network.getSUID(), node.getSUID()); String returnUri = new URIBuilder() .setScheme("http") .setHost("localhost") .setPath(returnPath) .setPort(port) .build() .toString(); String pcUri = new URIBuilder(pcBaseUri) .addParameter("uri", returnUri) .addParameter("q", nodeLabel) .build() .toString(); return pcUri; } catch(URISyntaxException e) { e.printStackTrace(); return null; } } | OpenPathwayCommonsTask extends AbstractTask { public String getPathwayCommonsURL() { EnrichmentMap map = emManager.getEnrichmentMap(network.getSUID()); if(map == null) return null; int port = Integer.parseInt(cy3props.getProperties().getProperty("rest.port")); String pcBaseUri = propertyManager.getValue(PropertyManager.PATHWAY_COMMONS_URL); String nodeLabel = getNodeLabel(map); try { String returnPath; if(node == null) returnPath = "/enrichmentmap/expressions/heatmap"; else returnPath = String.format("/enrichmentmap/expressions/%s/%s", network.getSUID(), node.getSUID()); String returnUri = new URIBuilder() .setScheme("http") .setHost("localhost") .setPath(returnPath) .setPort(port) .build() .toString(); String pcUri = new URIBuilder(pcBaseUri) .addParameter("uri", returnUri) .addParameter("q", nodeLabel) .build() .toString(); return pcUri; } catch(URISyntaxException e) { e.printStackTrace(); return null; } } } | OpenPathwayCommonsTask extends AbstractTask { public String getPathwayCommonsURL() { EnrichmentMap map = emManager.getEnrichmentMap(network.getSUID()); if(map == null) return null; int port = Integer.parseInt(cy3props.getProperties().getProperty("rest.port")); String pcBaseUri = propertyManager.getValue(PropertyManager.PATHWAY_COMMONS_URL); String nodeLabel = getNodeLabel(map); try { String returnPath; if(node == null) returnPath = "/enrichmentmap/expressions/heatmap"; else returnPath = String.format("/enrichmentmap/expressions/%s/%s", network.getSUID(), node.getSUID()); String returnUri = new URIBuilder() .setScheme("http") .setHost("localhost") .setPath(returnPath) .setPort(port) .build() .toString(); String pcUri = new URIBuilder(pcBaseUri) .addParameter("uri", returnUri) .addParameter("q", nodeLabel) .build() .toString(); return pcUri; } catch(URISyntaxException e) { e.printStackTrace(); return null; } } @AssistedInject OpenPathwayCommonsTask(@Assisted CyNetwork network, @Assisted CyNode node); @AssistedInject OpenPathwayCommonsTask(@Assisted CyNetwork network); } | OpenPathwayCommonsTask extends AbstractTask { public String getPathwayCommonsURL() { EnrichmentMap map = emManager.getEnrichmentMap(network.getSUID()); if(map == null) return null; int port = Integer.parseInt(cy3props.getProperties().getProperty("rest.port")); String pcBaseUri = propertyManager.getValue(PropertyManager.PATHWAY_COMMONS_URL); String nodeLabel = getNodeLabel(map); try { String returnPath; if(node == null) returnPath = "/enrichmentmap/expressions/heatmap"; else returnPath = String.format("/enrichmentmap/expressions/%s/%s", network.getSUID(), node.getSUID()); String returnUri = new URIBuilder() .setScheme("http") .setHost("localhost") .setPath(returnPath) .setPort(port) .build() .toString(); String pcUri = new URIBuilder(pcBaseUri) .addParameter("uri", returnUri) .addParameter("q", nodeLabel) .build() .toString(); return pcUri; } catch(URISyntaxException e) { e.printStackTrace(); return null; } } @AssistedInject OpenPathwayCommonsTask(@Assisted CyNetwork network, @Assisted CyNode node); @AssistedInject OpenPathwayCommonsTask(@Assisted CyNetwork network); String getPathwayCommonsURL(); @Override void run(TaskMonitor taskMonitor); } | OpenPathwayCommonsTask extends AbstractTask { public String getPathwayCommonsURL() { EnrichmentMap map = emManager.getEnrichmentMap(network.getSUID()); if(map == null) return null; int port = Integer.parseInt(cy3props.getProperties().getProperty("rest.port")); String pcBaseUri = propertyManager.getValue(PropertyManager.PATHWAY_COMMONS_URL); String nodeLabel = getNodeLabel(map); try { String returnPath; if(node == null) returnPath = "/enrichmentmap/expressions/heatmap"; else returnPath = String.format("/enrichmentmap/expressions/%s/%s", network.getSUID(), node.getSUID()); String returnUri = new URIBuilder() .setScheme("http") .setHost("localhost") .setPath(returnPath) .setPort(port) .build() .toString(); String pcUri = new URIBuilder(pcBaseUri) .addParameter("uri", returnUri) .addParameter("q", nodeLabel) .build() .toString(); return pcUri; } catch(URISyntaxException e) { e.printStackTrace(); return null; } } @AssistedInject OpenPathwayCommonsTask(@Assisted CyNetwork network, @Assisted CyNode node); @AssistedInject OpenPathwayCommonsTask(@Assisted CyNetwork network); String getPathwayCommonsURL(); @Override void run(TaskMonitor taskMonitor); static final String DEFAULT_BASE_URL; } |
@Test public void addSpyEventHandler_alreadyExists() { final SpyEventHandlerSupport support = new SpyEventHandlerSupport(); final SpyEventHandler handler = new TestSpyEventHandler( Arez.context() ); support.addSpyEventHandler( handler ); assertInvariantFailure( () -> support.addSpyEventHandler( handler ), "Arez-0102: Attempting to add handler " + handler + " that is already " + "in the list of spy handlers." ); } | void addSpyEventHandler( @Nonnull final SpyEventHandler handler ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> !_spyEventHandlers.contains( handler ), () -> "Arez-0102: Attempting to add handler " + handler + " that is already " + "in the list of spy handlers." ); } _spyEventHandlers.add( Objects.requireNonNull( handler ) ); } | SpyEventHandlerSupport { void addSpyEventHandler( @Nonnull final SpyEventHandler handler ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> !_spyEventHandlers.contains( handler ), () -> "Arez-0102: Attempting to add handler " + handler + " that is already " + "in the list of spy handlers." ); } _spyEventHandlers.add( Objects.requireNonNull( handler ) ); } } | SpyEventHandlerSupport { void addSpyEventHandler( @Nonnull final SpyEventHandler handler ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> !_spyEventHandlers.contains( handler ), () -> "Arez-0102: Attempting to add handler " + handler + " that is already " + "in the list of spy handlers." ); } _spyEventHandlers.add( Objects.requireNonNull( handler ) ); } } | SpyEventHandlerSupport { void addSpyEventHandler( @Nonnull final SpyEventHandler handler ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> !_spyEventHandlers.contains( handler ), () -> "Arez-0102: Attempting to add handler " + handler + " that is already " + "in the list of spy handlers." ); } _spyEventHandlers.add( Objects.requireNonNull( handler ) ); } } | SpyEventHandlerSupport { void addSpyEventHandler( @Nonnull final SpyEventHandler handler ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> !_spyEventHandlers.contains( handler ), () -> "Arez-0102: Attempting to add handler " + handler + " that is already " + "in the list of spy handlers." ); } _spyEventHandlers.add( Objects.requireNonNull( handler ) ); } } |
@Test public void verifyActionFlags_badVerifyAction() { final Procedure executable = () -> { }; assertInvariantFailure( () -> Arez.context() .action( executable, ActionFlags.VERIFY_ACTION_REQUIRED | ActionFlags.NO_VERIFY_ACTION_REQUIRED ), "Arez-0127: Flags passed to action 'Action@1' include both VERIFY_ACTION_REQUIRED and NO_VERIFY_ACTION_REQUIRED." ); } | public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void action_procedure_verifyActionRequired_false() throws Throwable { final Procedure executable = ValueUtil::randomString; Arez.context().action( executable, ActionFlags.NO_VERIFY_ACTION_REQUIRED ); } | public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void action_procedure_verifyActionRequired_true_butInvariantsDisabled() throws Throwable { ArezTestUtil.noCheckInvariants(); final Procedure executable = ValueUtil::randomString; Arez.context().action( executable, ActionFlags.VERIFY_ACTION_REQUIRED ); } | public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void action_procedure_verifyActionRequired_true() { final Procedure procedure = ValueUtil::randomString; assertInvariantFailure( () -> Arez.context().action( "X", procedure, ActionFlags.VERIFY_ACTION_REQUIRED ), "Arez-0185: Action named 'X' completed but no reads, writes, schedules, reportStales or reportPossiblyChanged occurred within the scope of the action." ); } | public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void action_procedure_verifyActionRequired_true_is_default() { assertInvariantFailure( () -> Arez.context().action( "X", (Procedure) ValueUtil::randomString ), "Arez-0185: Action named 'X' completed but no reads, writes, schedules, reportStales or reportPossiblyChanged occurred within the scope of the action." ); } | public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void action_function_verifyActionRequired_false() throws Throwable { Arez.context().action( (Function<String>) ValueUtil::randomString, ActionFlags.NO_VERIFY_ACTION_REQUIRED ); } | public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void action_function_verifyActionRequired_true_butInvariantsDisabled() throws Throwable { ArezTestUtil.noCheckInvariants(); Arez.context().action( (Function<String>) ValueUtil::randomString, ActionFlags.VERIFY_ACTION_REQUIRED ); } | public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void action_function_verifyActionRequired_true() { final Function<String> function = ValueUtil::randomString; assertInvariantFailure( () -> Arez.context().action( "X", function, ActionFlags.VERIFY_ACTION_REQUIRED ), "Arez-0185: Action named 'X' completed but no reads, writes, schedules, reportStales or reportPossiblyChanged occurred within the scope of the action." ); } | public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void action_function_verifyActionRequired_true_is_default() { final Function<String> function = ValueUtil::randomString; assertInvariantFailure( () -> Arez.context().action( "X", function ), "Arez-0185: Action named 'X' completed but no reads, writes, schedules, reportStales or reportPossiblyChanged occurred within the scope of the action." ); } | public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T action( @Nonnull final Function<T> executable ) throws Throwable { return action( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void safeAction_procedure_verifyActionRequired_false() { final SafeProcedure procedure = ValueUtil::randomString; Arez.context().safeAction( ValueUtil.randomString(), procedure, ActionFlags.NO_VERIFY_ACTION_REQUIRED ); } | public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void asComputableValue() { final ArezContext context = Arez.context(); final String name = ValueUtil.randomString(); final ComputableValue<String> computableValue = context.computable( name, () -> "" ); final Observer observer = computableValue.getObserver(); final ObserverInfo info = observer.asInfo(); assertEquals( info.getName(), name ); assertTrue( info.isComputableValue() ); assertEquals( info.asComputableValue().getName(), computableValue.getName() ); assertFalse( info.isActive() ); } | @Nonnull @Override public ComputableValueInfo asComputableValue() { return _observer.getComputableValue().asInfo(); } | ObserverInfoImpl implements ObserverInfo { @Nonnull @Override public ComputableValueInfo asComputableValue() { return _observer.getComputableValue().asInfo(); } } | ObserverInfoImpl implements ObserverInfo { @Nonnull @Override public ComputableValueInfo asComputableValue() { return _observer.getComputableValue().asInfo(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); } | ObserverInfoImpl implements ObserverInfo { @Nonnull @Override public ComputableValueInfo asComputableValue() { return _observer.getComputableValue().asInfo(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean isRunning(); @Override boolean isScheduled(); @Override boolean isComputableValue(); @Override boolean isReadOnly(); @Nonnull @Override Priority getPriority(); @Nonnull @Override ComputableValueInfo asComputableValue(); @Nonnull @Override List<ObservableValueInfo> getDependencies(); @Nullable @Override ComponentInfo getComponent(); @Override boolean isDisposed(); @Override String toString(); @Override boolean equals( final Object o ); @Override int hashCode(); } | ObserverInfoImpl implements ObserverInfo { @Nonnull @Override public ComputableValueInfo asComputableValue() { return _observer.getComputableValue().asInfo(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean isRunning(); @Override boolean isScheduled(); @Override boolean isComputableValue(); @Override boolean isReadOnly(); @Nonnull @Override Priority getPriority(); @Nonnull @Override ComputableValueInfo asComputableValue(); @Nonnull @Override List<ObservableValueInfo> getDependencies(); @Nullable @Override ComponentInfo getComponent(); @Override boolean isDisposed(); @Override String toString(); @Override boolean equals( final Object o ); @Override int hashCode(); } |
@Test public void safeAction_procedure_verifyActionRequired_true_butInvariantsDisabled() { ArezTestUtil.noCheckInvariants(); final SafeProcedure executable = ValueUtil::randomString; Arez.context().safeAction( ValueUtil.randomString(), executable, ActionFlags.VERIFY_ACTION_REQUIRED ); } | public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void safeAction_procedure_verifyActionRequired_true() { final SafeProcedure procedure = ValueUtil::randomString; assertInvariantFailure( () -> Arez.context().safeAction( "X", procedure, ActionFlags.VERIFY_ACTION_REQUIRED ), "Arez-0185: Action named 'X' completed but no reads, writes, schedules, reportStales or reportPossiblyChanged occurred within the scope of the action." ); } | public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void safeAction_procedure_verifyActionRequired_true_is_default() { assertInvariantFailure( () -> Arez.context().safeAction( "X", (SafeProcedure) ValueUtil::randomString ), "Arez-0185: Action named 'X' completed but no reads, writes, schedules, reportStales or reportPossiblyChanged occurred within the scope of the action." ); } | public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void safeAction_function_verifyActionRequired_false() { Arez.context().safeAction( (SafeFunction<String>) ValueUtil::randomString, ActionFlags.NO_VERIFY_ACTION_REQUIRED ); } | public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void safeAction_function_verifyActionRequired_true_butInvariantsDisabled() { ArezTestUtil.noCheckInvariants(); Arez.context().safeAction( (SafeFunction<String>) ValueUtil::randomString, ActionFlags.VERIFY_ACTION_REQUIRED ); } | public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void safeAction_function_verifyActionRequired_true() { final SafeFunction<String> function = ValueUtil::randomString; assertInvariantFailure( () -> Arez.context().safeAction( "X", function, ActionFlags.VERIFY_ACTION_REQUIRED ), "Arez-0185: Action named 'X' completed but no reads, writes, schedules, reportStales or reportPossiblyChanged occurred within the scope of the action." ); } | public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void safeAction_function_verifyActionRequired_true_is_default() { assertInvariantFailure( () -> Arez.context().safeAction( "X", (SafeFunction<String>) ValueUtil::randomString ), "Arez-0185: Action named 'X' completed but no reads, writes, schedules, reportStales or reportPossiblyChanged occurred within the scope of the action." ); } | public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { public <T> T safeAction( @Nonnull final SafeFunction<T> executable ) { return safeAction( executable, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void addObserverErrorHandler_whenDisabled() { ArezTestUtil.disableObserverErrorHandlers(); final ObserverErrorHandler handler = ( o, e, t ) -> { }; assertInvariantFailure( () -> Arez.context().addObserverErrorHandler( handler ), "Arez-0182: ArezContext.addObserverErrorHandler() invoked when Arez.areObserverErrorHandlersEnabled() returns false." ); } | @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) public void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ) { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areObserverErrorHandlersEnabled, () -> "Arez-0182: ArezContext.addObserverErrorHandler() invoked when Arez.areObserverErrorHandlersEnabled() returns false." ); } getObserverErrorHandlerSupport().addObserverErrorHandler( handler ); } | ArezContext { @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) public void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ) { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areObserverErrorHandlersEnabled, () -> "Arez-0182: ArezContext.addObserverErrorHandler() invoked when Arez.areObserverErrorHandlersEnabled() returns false." ); } getObserverErrorHandlerSupport().addObserverErrorHandler( handler ); } } | ArezContext { @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) public void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ) { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areObserverErrorHandlersEnabled, () -> "Arez-0182: ArezContext.addObserverErrorHandler() invoked when Arez.areObserverErrorHandlersEnabled() returns false." ); } getObserverErrorHandlerSupport().addObserverErrorHandler( handler ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) public void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ) { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areObserverErrorHandlersEnabled, () -> "Arez-0182: ArezContext.addObserverErrorHandler() invoked when Arez.areObserverErrorHandlersEnabled() returns false." ); } getObserverErrorHandlerSupport().addObserverErrorHandler( handler ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) public void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ) { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areObserverErrorHandlersEnabled, () -> "Arez-0182: ArezContext.addObserverErrorHandler() invoked when Arez.areObserverErrorHandlersEnabled() returns false." ); } getObserverErrorHandlerSupport().addObserverErrorHandler( handler ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void removeObserverErrorHandler_whenDisabled() { ArezTestUtil.disableObserverErrorHandlers(); final ArezContext context = Arez.context(); final ObserverErrorHandler handler = ( o, e, t ) -> { }; assertInvariantFailure( () -> context.removeObserverErrorHandler( handler ), "Arez-0181: ArezContext.removeObserverErrorHandler() invoked when Arez.areObserverErrorHandlersEnabled() returns false." ); } | @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) public void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ) { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areObserverErrorHandlersEnabled, () -> "Arez-0181: ArezContext.removeObserverErrorHandler() invoked when Arez.areObserverErrorHandlersEnabled() returns false." ); } getObserverErrorHandlerSupport().removeObserverErrorHandler( handler ); } | ArezContext { @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) public void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ) { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areObserverErrorHandlersEnabled, () -> "Arez-0181: ArezContext.removeObserverErrorHandler() invoked when Arez.areObserverErrorHandlersEnabled() returns false." ); } getObserverErrorHandlerSupport().removeObserverErrorHandler( handler ); } } | ArezContext { @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) public void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ) { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areObserverErrorHandlersEnabled, () -> "Arez-0181: ArezContext.removeObserverErrorHandler() invoked when Arez.areObserverErrorHandlersEnabled() returns false." ); } getObserverErrorHandlerSupport().removeObserverErrorHandler( handler ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) public void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ) { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areObserverErrorHandlersEnabled, () -> "Arez-0181: ArezContext.removeObserverErrorHandler() invoked when Arez.areObserverErrorHandlersEnabled() returns false." ); } getObserverErrorHandlerSupport().removeObserverErrorHandler( handler ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) public void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ) { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areObserverErrorHandlersEnabled, () -> "Arez-0181: ArezContext.removeObserverErrorHandler() invoked when Arez.areObserverErrorHandlersEnabled() returns false." ); } getObserverErrorHandlerSupport().removeObserverErrorHandler( handler ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void scheduleReaction() { final ArezContext context = Arez.context(); final Observer observer = context.observer( new CountAndObserveProcedure() ); assertEquals( context.getTaskQueue().getOrderedTasks().count(), 0L ); context.scheduleReaction( observer ); assertEquals( context.getTaskQueue().getOrderedTasks().count(), 1L ); assertTrue( context.getTaskQueue().getOrderedTasks().anyMatch( o -> o == observer.getTask() ) ); } | void scheduleReaction( @Nonnull final Observer observer ) { if ( willPropagateSpyEvents() ) { getSpy().reportSpyEvent( new ObserveScheduleEvent( observer.asInfo() ) ); } if ( Arez.shouldEnforceTransactionType() && isTransactionActive() && Arez.shouldCheckInvariants() ) { invariant( () -> getTransaction().isMutation() || getTransaction().isComputableValueTracker(), () -> "Arez-0013: Observer named '" + observer.getName() + "' attempted to be scheduled during " + "read-only transaction." ); invariant( () -> getTransaction().getTracker() != observer || getTransaction().isMutation(), () -> "Arez-0014: Observer named '" + observer.getName() + "' attempted to schedule itself during " + "read-only tracking transaction. Observers that are supporting ComputableValue instances " + "must not schedule self." ); } _taskQueue.queueTask( observer.getTask() ); } | ArezContext { void scheduleReaction( @Nonnull final Observer observer ) { if ( willPropagateSpyEvents() ) { getSpy().reportSpyEvent( new ObserveScheduleEvent( observer.asInfo() ) ); } if ( Arez.shouldEnforceTransactionType() && isTransactionActive() && Arez.shouldCheckInvariants() ) { invariant( () -> getTransaction().isMutation() || getTransaction().isComputableValueTracker(), () -> "Arez-0013: Observer named '" + observer.getName() + "' attempted to be scheduled during " + "read-only transaction." ); invariant( () -> getTransaction().getTracker() != observer || getTransaction().isMutation(), () -> "Arez-0014: Observer named '" + observer.getName() + "' attempted to schedule itself during " + "read-only tracking transaction. Observers that are supporting ComputableValue instances " + "must not schedule self." ); } _taskQueue.queueTask( observer.getTask() ); } } | ArezContext { void scheduleReaction( @Nonnull final Observer observer ) { if ( willPropagateSpyEvents() ) { getSpy().reportSpyEvent( new ObserveScheduleEvent( observer.asInfo() ) ); } if ( Arez.shouldEnforceTransactionType() && isTransactionActive() && Arez.shouldCheckInvariants() ) { invariant( () -> getTransaction().isMutation() || getTransaction().isComputableValueTracker(), () -> "Arez-0013: Observer named '" + observer.getName() + "' attempted to be scheduled during " + "read-only transaction." ); invariant( () -> getTransaction().getTracker() != observer || getTransaction().isMutation(), () -> "Arez-0014: Observer named '" + observer.getName() + "' attempted to schedule itself during " + "read-only tracking transaction. Observers that are supporting ComputableValue instances " + "must not schedule self." ); } _taskQueue.queueTask( observer.getTask() ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { void scheduleReaction( @Nonnull final Observer observer ) { if ( willPropagateSpyEvents() ) { getSpy().reportSpyEvent( new ObserveScheduleEvent( observer.asInfo() ) ); } if ( Arez.shouldEnforceTransactionType() && isTransactionActive() && Arez.shouldCheckInvariants() ) { invariant( () -> getTransaction().isMutation() || getTransaction().isComputableValueTracker(), () -> "Arez-0013: Observer named '" + observer.getName() + "' attempted to be scheduled during " + "read-only transaction." ); invariant( () -> getTransaction().getTracker() != observer || getTransaction().isMutation(), () -> "Arez-0014: Observer named '" + observer.getName() + "' attempted to schedule itself during " + "read-only tracking transaction. Observers that are supporting ComputableValue instances " + "must not schedule self." ); } _taskQueue.queueTask( observer.getTask() ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { void scheduleReaction( @Nonnull final Observer observer ) { if ( willPropagateSpyEvents() ) { getSpy().reportSpyEvent( new ObserveScheduleEvent( observer.asInfo() ) ); } if ( Arez.shouldEnforceTransactionType() && isTransactionActive() && Arez.shouldCheckInvariants() ) { invariant( () -> getTransaction().isMutation() || getTransaction().isComputableValueTracker(), () -> "Arez-0013: Observer named '" + observer.getName() + "' attempted to be scheduled during " + "read-only transaction." ); invariant( () -> getTransaction().getTracker() != observer || getTransaction().isMutation(), () -> "Arez-0014: Observer named '" + observer.getName() + "' attempted to schedule itself during " + "read-only tracking transaction. Observers that are supporting ComputableValue instances " + "must not schedule self." ); } _taskQueue.queueTask( observer.getTask() ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void getComponent_Observer_nativeComponentsDisabled() { ArezTestUtil.disableNativeComponents(); final ArezContext context = Arez.context(); final Spy spy = context.getSpy(); final Observer observer = context.observer( AbstractTest::observeADependency ); assertInvariantFailure( () -> spy.asObserverInfo( observer ).getComponent(), "Arez-0108: Spy.getComponent invoked when Arez.areNativeComponentsEnabled() returns false." ); } | @Nullable @Override public ComponentInfo getComponent() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areNativeComponentsEnabled, () -> "Arez-0108: Spy.getComponent invoked when Arez.areNativeComponentsEnabled() returns false." ); } final Component component = _observer.getComponent(); return null == component ? null : component.asInfo(); } | ObserverInfoImpl implements ObserverInfo { @Nullable @Override public ComponentInfo getComponent() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areNativeComponentsEnabled, () -> "Arez-0108: Spy.getComponent invoked when Arez.areNativeComponentsEnabled() returns false." ); } final Component component = _observer.getComponent(); return null == component ? null : component.asInfo(); } } | ObserverInfoImpl implements ObserverInfo { @Nullable @Override public ComponentInfo getComponent() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areNativeComponentsEnabled, () -> "Arez-0108: Spy.getComponent invoked when Arez.areNativeComponentsEnabled() returns false." ); } final Component component = _observer.getComponent(); return null == component ? null : component.asInfo(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); } | ObserverInfoImpl implements ObserverInfo { @Nullable @Override public ComponentInfo getComponent() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areNativeComponentsEnabled, () -> "Arez-0108: Spy.getComponent invoked when Arez.areNativeComponentsEnabled() returns false." ); } final Component component = _observer.getComponent(); return null == component ? null : component.asInfo(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean isRunning(); @Override boolean isScheduled(); @Override boolean isComputableValue(); @Override boolean isReadOnly(); @Nonnull @Override Priority getPriority(); @Nonnull @Override ComputableValueInfo asComputableValue(); @Nonnull @Override List<ObservableValueInfo> getDependencies(); @Nullable @Override ComponentInfo getComponent(); @Override boolean isDisposed(); @Override String toString(); @Override boolean equals( final Object o ); @Override int hashCode(); } | ObserverInfoImpl implements ObserverInfo { @Nullable @Override public ComponentInfo getComponent() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areNativeComponentsEnabled, () -> "Arez-0108: Spy.getComponent invoked when Arez.areNativeComponentsEnabled() returns false." ); } final Component component = _observer.getComponent(); return null == component ? null : component.asInfo(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean isRunning(); @Override boolean isScheduled(); @Override boolean isComputableValue(); @Override boolean isReadOnly(); @Nonnull @Override Priority getPriority(); @Nonnull @Override ComputableValueInfo asComputableValue(); @Nonnull @Override List<ObservableValueInfo> getDependencies(); @Nullable @Override ComponentInfo getComponent(); @Override boolean isDisposed(); @Override String toString(); @Override boolean equals( final Object o ); @Override int hashCode(); } |
@Test public void computableValue() { final ArezContext context = Arez.context(); final String name = ValueUtil.randomString(); final SafeFunction<String> function = () -> { observeADependency(); return ""; }; final Procedure onActivate = ValueUtil::randomString; final Procedure onDeactivate = ValueUtil::randomString; final ComputableValue<String> computableValue = context.computable( null, name, function, onActivate, onDeactivate, ComputableValue.Flags.PRIORITY_HIGH ); assertEquals( computableValue.getName(), name ); assertEquals( computableValue.getContext(), context ); assertFalse( computableValue.getObserver().isKeepAlive() ); assertTrue( computableValue.getObserver().areArezDependenciesRequired() ); assertEquals( computableValue.getObservableValue().getName(), name ); assertEquals( computableValue.getOnActivate(), onActivate ); assertEquals( computableValue.getOnDeactivate(), onDeactivate ); assertEquals( computableValue.getObserver().getName(), name ); assertEquals( computableValue.getObserver().getTask().getPriority(), Priority.HIGH ); assertFalse( computableValue.getObserver().canObserveLowerPriorityDependencies() ); } | @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void computableValue_canObserveLowerPriorityDependencies() { final ComputableValue<String> computableValue = Arez.context().computable( () -> "", ComputableValue.Flags.OBSERVE_LOWER_PRIORITY_DEPENDENCIES ); assertTrue( computableValue.getObserver().canObserveLowerPriorityDependencies() ); } | @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void computableValue_mayNotAccessArezState() { final ArezContext context = Arez.context(); assertFalse( context.computable( () -> "", ComputableValue.Flags.AREZ_OR_NO_DEPENDENCIES ) .getObserver() .areArezDependenciesRequired() ); assertFalse( context.computable( () -> "", ComputableValue.Flags.AREZ_OR_EXTERNAL_DEPENDENCIES ) .getObserver() .areArezDependenciesRequired() ); } | @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void computableValue_withKeepAliveAndRunImmediately() { final ArezContext context = Arez.context(); final AtomicInteger calls = new AtomicInteger(); final SafeFunction<String> action = () -> { observeADependency(); calls.incrementAndGet(); return ""; }; final ComputableValue<String> computableValue = context.computable( action, ComputableValue.Flags.KEEPALIVE | ComputableValue.Flags.RUN_NOW ); assertTrue( computableValue.getObserver().isKeepAlive() ); assertEquals( calls.get(), 1 ); } | @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void computableValue_pass_no_hooks() { final ArezContext context = Arez.context(); final String name = ValueUtil.randomString(); final SafeFunction<String> function = () -> { observeADependency(); return ""; }; final ComputableValue<String> computableValue = context.computable( name, function ); assertEquals( computableValue.getName(), name ); assertEquals( computableValue.getContext(), context ); assertEquals( computableValue.getObserver().getName(), name ); assertEquals( computableValue.getObservableValue().getName(), name ); assertNull( computableValue.getOnActivate() ); assertNull( computableValue.getOnDeactivate() ); assertEquals( computableValue.getObserver().getTask().getPriority(), Priority.NORMAL ); } | @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void computableValue_generates_spyEvent() { final ArezContext context = Arez.context(); final TestSpyEventHandler handler = TestSpyEventHandler.subscribe( context ); final ComputableValue<String> computableValue = context.computable( ValueUtil.randomString(), () -> { observeADependency(); return ""; } ); handler.assertEventCount( 1 ); handler.assertNextEvent( ComputableValueCreateEvent.class, event -> assertEquals( event.getComputableValue().getName(), computableValue.getName() ) ); } | @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public <T> ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ) { return computable( function, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void autorun_noObservers_manualReportStaleAllowed() { ignoreObserverErrors(); final ArezContext context = Arez.context(); final AtomicInteger callCount = new AtomicInteger(); context.observer( callCount::incrementAndGet, Observer.Flags.AREZ_OR_EXTERNAL_DEPENDENCIES ); assertEquals( callCount.get(), 1 ); assertEquals( getObserverErrors().size(), 0 ); } | @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void autorun_highPriority() { final ArezContext context = Arez.context(); final Observer observer = context.observer( AbstractTest::observeADependency, Observer.Flags.PRIORITY_HIGH ); assertEquals( observer.getTask().getPriority(), Priority.HIGH ); } | @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void autorun_canObserveLowerPriorityDependencies() { final ArezContext context = Arez.context(); final Observer observer = context.observer( AbstractTest::observeADependency, Observer.Flags.OBSERVE_LOWER_PRIORITY_DEPENDENCIES ); assertTrue( observer.canObserveLowerPriorityDependencies() ); } | @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void autorun_nestedActionsAllowed() { final ArezContext context = Arez.context(); final Observer observer = context.observer( AbstractTest::observeADependency, Observer.Flags.NESTED_ACTIONS_ALLOWED ); assertTrue( observer.nestedActionsAllowed() ); } | @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@SuppressWarnings( "EqualsWithItself" ) @Test public void equalsAndHashCode() { final ArezContext context = Arez.context(); final ObservableValue<Object> observableValue = context.observable(); final Observer observer1 = context.observer( ValueUtil.randomString(), observableValue::reportObserved ); final Observer observer2 = context.observer( ValueUtil.randomString(), observableValue::reportObserved ); final ObserverInfo info1a = observer1.asInfo(); final ObserverInfo info1b = new ObserverInfoImpl( context.getSpy(), observer1 ); final ObserverInfo info2 = observer2.asInfo(); assertNotEquals( info1a, "" ); assertEquals( info1a, info1a ); assertEquals( info1b, info1a ); assertNotEquals( info2, info1a ); assertEquals( info1a, info1b ); assertEquals( info1b, info1b ); assertNotEquals( info2, info1b ); assertNotEquals( info1a, info2 ); assertNotEquals( info1b, info2 ); assertEquals( info2, info2 ); assertEquals( info1a.hashCode(), observer1.hashCode() ); assertEquals( info1a.hashCode(), info1b.hashCode() ); assertEquals( info2.hashCode(), observer2.hashCode() ); } | @Override public int hashCode() { return _observer.hashCode(); } | ObserverInfoImpl implements ObserverInfo { @Override public int hashCode() { return _observer.hashCode(); } } | ObserverInfoImpl implements ObserverInfo { @Override public int hashCode() { return _observer.hashCode(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); } | ObserverInfoImpl implements ObserverInfo { @Override public int hashCode() { return _observer.hashCode(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean isRunning(); @Override boolean isScheduled(); @Override boolean isComputableValue(); @Override boolean isReadOnly(); @Nonnull @Override Priority getPriority(); @Nonnull @Override ComputableValueInfo asComputableValue(); @Nonnull @Override List<ObservableValueInfo> getDependencies(); @Nullable @Override ComponentInfo getComponent(); @Override boolean isDisposed(); @Override String toString(); @Override boolean equals( final Object o ); @Override int hashCode(); } | ObserverInfoImpl implements ObserverInfo { @Override public int hashCode() { return _observer.hashCode(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean isRunning(); @Override boolean isScheduled(); @Override boolean isComputableValue(); @Override boolean isReadOnly(); @Nonnull @Override Priority getPriority(); @Nonnull @Override ComputableValueInfo asComputableValue(); @Nonnull @Override List<ObservableValueInfo> getDependencies(); @Nullable @Override ComponentInfo getComponent(); @Override boolean isDisposed(); @Override String toString(); @Override boolean equals( final Object o ); @Override int hashCode(); } |
@Test public void observer_areArezDependenciesRequired() { final ArezContext context = Arez.context(); final Procedure observe = AbstractTest::observeADependency; assertFalse( context.observer( observe, Observer.Flags.AREZ_OR_EXTERNAL_DEPENDENCIES ) .areArezDependenciesRequired() ); assertFalse( context.observer( observe, Observer.Flags.AREZ_OR_NO_DEPENDENCIES ).areArezDependenciesRequired() ); assertTrue( context.observer( observe, Observer.Flags.AREZ_DEPENDENCIES ).areArezDependenciesRequired() ); } | @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void autorun_supportsManualSchedule() { final ArezContext context = Arez.context(); final Observer observer = context.observer( AbstractTest::observeADependency, ValueUtil::randomString ); assertTrue( observer.supportsManualSchedule() ); } | @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public Observer observer( @Nonnull final Procedure observe ) { return observer( observe, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void tracker() { final ArezContext context = Arez.context(); final TestSpyEventHandler handler = TestSpyEventHandler.subscribe( context ); final String name = ValueUtil.randomString(); final AtomicInteger callCount = new AtomicInteger(); final Observer observer = context.tracker( null, name, callCount::incrementAndGet, Observer.Flags.PRIORITY_HIGH | Observer.Flags.OBSERVE_LOWER_PRIORITY_DEPENDENCIES | Observer.Flags.NESTED_ACTIONS_ALLOWED | Observer.Flags.AREZ_OR_NO_DEPENDENCIES ); assertEquals( observer.getName(), name ); assertFalse( observer.isMutation() ); assertEquals( observer.getState(), Observer.Flags.STATE_INACTIVE ); assertNull( observer.getComponent() ); assertEquals( observer.getTask().getPriority(), Priority.HIGH ); assertTrue( observer.canObserveLowerPriorityDependencies() ); assertTrue( observer.isApplicationExecutor() ); assertTrue( observer.nestedActionsAllowed() ); assertFalse( observer.areArezDependenciesRequired() ); assertFalse( observer.supportsManualSchedule() ); assertEquals( callCount.get(), 0 ); assertEquals( context.getTaskQueue().getOrderedTasks().count(), 0L ); handler.assertEventCount( 1 ); handler.assertNextEvent( ObserverCreateEvent.class, e -> assertEquals( e.getObserver().getName(), observer.getName() ) ); } | @Nonnull public Observer tracker( @Nonnull final Procedure onDepsChange ) { return tracker( onDepsChange, 0 ); } | ArezContext { @Nonnull public Observer tracker( @Nonnull final Procedure onDepsChange ) { return tracker( onDepsChange, 0 ); } } | ArezContext { @Nonnull public Observer tracker( @Nonnull final Procedure onDepsChange ) { return tracker( onDepsChange, 0 ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public Observer tracker( @Nonnull final Procedure onDepsChange ) { return tracker( onDepsChange, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public Observer tracker( @Nonnull final Procedure onDepsChange ) { return tracker( onDepsChange, 0 ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void createObservable() { final ArezContext context = Arez.context(); final String name = ValueUtil.randomString(); final ObservableValue<?> observableValue = context.observable( name ); assertEquals( observableValue.getName(), name ); assertNull( observableValue.getAccessor() ); assertNull( observableValue.getMutator() ); } | @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void createObservable_withIntrospectors() { final ArezContext context = Arez.context(); final String name = ValueUtil.randomString(); final PropertyAccessor<String> accessor = () -> ""; final PropertyMutator<String> mutator = v -> { }; final ObservableValue<?> observableValue = context.observable( name, accessor, mutator ); assertEquals( observableValue.getName(), name ); assertEquals( observableValue.getAccessor(), accessor ); assertEquals( observableValue.getMutator(), mutator ); } | @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void createObservable_spyEventHandlerPresent() { final ArezContext context = Arez.context(); final TestSpyEventHandler handler = TestSpyEventHandler.subscribe( context ); final String name = ValueUtil.randomString(); final ObservableValue<?> observableValue = context.observable( name ); assertEquals( observableValue.getName(), name ); handler.assertEventCount( 1 ); handler.assertNextEvent( ObservableValueCreateEvent.class, e -> assertEquals( e.getObservableValue().getName(), observableValue.getName() ) ); } | @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void createObservable_name_Null() { ArezTestUtil.disableNames(); final ArezContext context = Arez.context(); final ObservableValue<?> observableValue = context.observable( null ); assertNotNull( observableValue ); } | @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public <T> ObservableValue<T> observable() { return observable( null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void pauseScheduler() { final ArezContext context = Arez.context(); assertFalse( context.isSchedulerPaused() ); assertEquals( context.getSchedulerLockCount(), 0 ); final SchedulerLock lock1 = context.pauseScheduler(); assertEquals( context.getSchedulerLockCount(), 1 ); assertTrue( context.isSchedulerPaused() ); final AtomicInteger callCount = new AtomicInteger(); context.observer( () -> { observeADependency(); callCount.incrementAndGet(); }, Observer.Flags.RUN_LATER ); context.triggerScheduler(); assertEquals( callCount.get(), 0 ); final SchedulerLock lock2 = context.pauseScheduler(); assertEquals( context.getSchedulerLockCount(), 2 ); assertTrue( context.isSchedulerPaused() ); lock2.dispose(); assertEquals( context.getSchedulerLockCount(), 1 ); lock2.dispose(); assertEquals( context.getSchedulerLockCount(), 1 ); assertTrue( context.isSchedulerPaused() ); assertEquals( callCount.get(), 0 ); lock1.dispose(); assertEquals( context.getSchedulerLockCount(), 0 ); assertEquals( callCount.get(), 1 ); assertFalse( context.isSchedulerPaused() ); } | @Nonnull public SchedulerLock pauseScheduler() { _schedulerLockCount++; return new SchedulerLock( Arez.areZonesEnabled() ? this : null ); } | ArezContext { @Nonnull public SchedulerLock pauseScheduler() { _schedulerLockCount++; return new SchedulerLock( Arez.areZonesEnabled() ? this : null ); } } | ArezContext { @Nonnull public SchedulerLock pauseScheduler() { _schedulerLockCount++; return new SchedulerLock( Arez.areZonesEnabled() ? this : null ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @Nonnull public SchedulerLock pauseScheduler() { _schedulerLockCount++; return new SchedulerLock( Arez.areZonesEnabled() ? this : null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @Nonnull public SchedulerLock pauseScheduler() { _schedulerLockCount++; return new SchedulerLock( Arez.areZonesEnabled() ? this : null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void releaseSchedulerLock_whenNoLock() { assertInvariantFailure( () -> Arez.context().releaseSchedulerLock(), "Arez-0016: releaseSchedulerLock() reduced schedulerLockCount below 0." ); } | void releaseSchedulerLock() { _schedulerLockCount--; if ( Arez.shouldCheckInvariants() ) { invariant( () -> _schedulerLockCount >= 0, () -> "Arez-0016: releaseSchedulerLock() reduced schedulerLockCount below 0." ); } triggerScheduler(); } | ArezContext { void releaseSchedulerLock() { _schedulerLockCount--; if ( Arez.shouldCheckInvariants() ) { invariant( () -> _schedulerLockCount >= 0, () -> "Arez-0016: releaseSchedulerLock() reduced schedulerLockCount below 0." ); } triggerScheduler(); } } | ArezContext { void releaseSchedulerLock() { _schedulerLockCount--; if ( Arez.shouldCheckInvariants() ) { invariant( () -> _schedulerLockCount >= 0, () -> "Arez-0016: releaseSchedulerLock() reduced schedulerLockCount below 0." ); } triggerScheduler(); } ArezContext( @Nullable final Zone zone ); } | ArezContext { void releaseSchedulerLock() { _schedulerLockCount--; if ( Arez.shouldCheckInvariants() ) { invariant( () -> _schedulerLockCount >= 0, () -> "Arez-0016: releaseSchedulerLock() reduced schedulerLockCount below 0." ); } triggerScheduler(); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { void releaseSchedulerLock() { _schedulerLockCount--; if ( Arez.shouldCheckInvariants() ) { invariant( () -> _schedulerLockCount >= 0, () -> "Arez-0016: releaseSchedulerLock() reduced schedulerLockCount below 0." ); } triggerScheduler(); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void createComponent_spyEventHandlerPresent() { final ArezContext context = Arez.context(); final TestSpyEventHandler handler = TestSpyEventHandler.subscribe( context ); final Component component = context.component( ValueUtil.randomString(), ValueUtil.randomString(), ValueUtil.randomString() ); handler.assertEventCount( 1 ); handler.assertNextEvent( ComponentCreateStartEvent.class, event -> assertEquals( event.getComponentInfo().getName(), component.getName() ) ); } | @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull public Component component( @Nonnull final String type, @Nonnull final Object id ) { return component( type, id, Arez.areNamesEnabled() ? type + "@" + id : null ); } | ArezContext { @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull public Component component( @Nonnull final String type, @Nonnull final Object id ) { return component( type, id, Arez.areNamesEnabled() ? type + "@" + id : null ); } } | ArezContext { @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull public Component component( @Nonnull final String type, @Nonnull final Object id ) { return component( type, id, Arez.areNamesEnabled() ? type + "@" + id : null ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull public Component component( @Nonnull final String type, @Nonnull final Object id ) { return component( type, id, Arez.areNamesEnabled() ? type + "@" + id : null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull public Component component( @Nonnull final String type, @Nonnull final Object id ) { return component( type, id, Arez.areNamesEnabled() ? type + "@" + id : null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
@Test public void isComputing() { final ArezContext context = Arez.context(); final Spy spy = context.getSpy(); final ComputableValue<String> computableValue = context.computable( () -> "" ); assertFalse( spy.asComputableValueInfo( computableValue ).isComputing() ); computableValue.setComputing( true ); assertTrue( spy.asComputableValueInfo( computableValue ).isComputing() ); } | @Override public boolean isComputing() { return _computableValue.isComputing(); } | ComputableValueInfoImpl implements ComputableValueInfo { @Override public boolean isComputing() { return _computableValue.isComputing(); } } | ComputableValueInfoImpl implements ComputableValueInfo { @Override public boolean isComputing() { return _computableValue.isComputing(); } ComputableValueInfoImpl( @Nonnull final ComputableValue<?> computableValue ); } | ComputableValueInfoImpl implements ComputableValueInfo { @Override public boolean isComputing() { return _computableValue.isComputing(); } ComputableValueInfoImpl( @Nonnull final ComputableValue<?> computableValue ); @Nonnull @Override String getName(); @Override boolean isComputing(); @Nonnull @Override Priority getPriority(); @Override boolean isActive(); @Nonnull @Override List<ObservableValueInfo> getDependencies(); @Nonnull @Override List<ObserverInfo> getObservers(); @Nullable @Override ComponentInfo getComponent(); @OmitSymbol( unless = "arez.enable_property_introspection" ) @Nullable @Override Object getValue(); @Override boolean isDisposed(); @Override String toString(); @Override boolean equals( final Object o ); @Override int hashCode(); } | ComputableValueInfoImpl implements ComputableValueInfo { @Override public boolean isComputing() { return _computableValue.isComputing(); } ComputableValueInfoImpl( @Nonnull final ComputableValue<?> computableValue ); @Nonnull @Override String getName(); @Override boolean isComputing(); @Nonnull @Override Priority getPriority(); @Override boolean isActive(); @Nonnull @Override List<ObservableValueInfo> getDependencies(); @Nonnull @Override List<ObserverInfo> getObservers(); @Nullable @Override ComponentInfo getComponent(); @OmitSymbol( unless = "arez.enable_property_introspection" ) @Nullable @Override Object getValue(); @Override boolean isDisposed(); @Override String toString(); @Override boolean equals( final Object o ); @Override int hashCode(); } |
@Test public void createComponent_nativeComponentsDisabled() { ArezTestUtil.disableNativeComponents(); final ArezContext context = Arez.context(); final String type = ValueUtil.randomString(); final String id = ValueUtil.randomString(); final String name = ValueUtil.randomString(); assertInvariantFailure( () -> context.component( type, id, name ), "Arez-0008: ArezContext.component() invoked when Arez.areNativeComponentsEnabled() returns false." ); } | @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull public Component component( @Nonnull final String type, @Nonnull final Object id ) { return component( type, id, Arez.areNamesEnabled() ? type + "@" + id : null ); } | ArezContext { @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull public Component component( @Nonnull final String type, @Nonnull final Object id ) { return component( type, id, Arez.areNamesEnabled() ? type + "@" + id : null ); } } | ArezContext { @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull public Component component( @Nonnull final String type, @Nonnull final Object id ) { return component( type, id, Arez.areNamesEnabled() ? type + "@" + id : null ); } ArezContext( @Nullable final Zone zone ); } | ArezContext { @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull public Component component( @Nonnull final String type, @Nonnull final Object id ) { return component( type, id, Arez.areNamesEnabled() ? type + "@" + id : null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } | ArezContext { @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull public Component component( @Nonnull final String type, @Nonnull final Object id ) { return component( type, id, Arez.areNamesEnabled() ? type + "@" + id : null ); } ArezContext( @Nullable final Zone zone ); @OmitSymbol( unless = "arez.enable_native_components" ) boolean isComponentPresent( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type, @Nonnull final Object id, @Nullable final String name ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose ); @OmitSymbol( unless = "arez.enable_native_components" ) @Nonnull Component component( @Nonnull final String type,
@Nonnull final Object id,
@Nullable final String name,
@Nullable final SafeProcedure preDispose,
@Nullable final SafeProcedure postDispose ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final String name, @Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate ); @Nonnull ComputableValue<T> computable( @Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull ComputableValue<T> computable( @Nullable final Component component,
@Nullable final String name,
@Nonnull final SafeFunction<T> function,
@Nullable final Procedure onActivate,
@Nullable final Procedure onDeactivate,
@MagicConstant( flagsFromClass = ComputableValue.Flags.class ) final int flags ); @Nonnull Observer observer( @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name, @Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure observe,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe, @Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange ); @Nonnull Observer observer( @Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer observer( @Nullable final Component component,
@Nullable final String name,
@Nullable final Procedure observe,
@Nullable final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final String name, @Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange ); @Nonnull Observer tracker( @Nullable final Component component,
@Nullable final String name,
@Nonnull final Procedure onDepsChange,
@MagicConstant( flagsFromClass = Observer.Flags.class ) final int flags ); @Nonnull ObservableValue<T> observable(); @Nonnull ObservableValue<T> observable( @Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor ); @Nonnull ObservableValue<T> observable( @Nullable final Component component,
@Nullable final String name,
@Nullable final PropertyAccessor<T> accessor,
@Nullable final PropertyMutator<T> mutator ); @Nonnull Task task( @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nullable final String name, @Nonnull final SafeProcedure work ); @Nonnull Task task( @Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); @Nonnull Task task( @Nullable final String name,
@Nonnull final SafeProcedure work,
@MagicConstant( flagsFromClass = Task.Flags.class ) final int flags ); boolean isSchedulerActive(); boolean isTransactionActive(); boolean isTrackingTransactionActive(); boolean isReadWriteTransactionActive(); boolean isReadOnlyTransactionActive(); boolean isSchedulerPaused(); @Nonnull SchedulerLock pauseScheduler(); @OmitSymbol( unless = "arez.enable_task_interceptor" ) void setTaskInterceptor( @Nullable final TaskInterceptor taskInterceptor ); void triggerScheduler(); T action( @Nonnull final Function<T> executable ); T action( @Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T action( @Nullable final String name,
@Nonnull final Function<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T observe( @Nonnull final Observer observer, @Nonnull final Function<T> observe ); T observe( @Nonnull final Observer observer,
@Nonnull final Function<T> observe,
@Nullable final Object[] parameters ); T safeAction( @Nonnull final SafeFunction<T> executable ); T safeAction( @Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name, @Nonnull final SafeFunction<T> executable ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); T safeAction( @Nullable final String name,
@Nonnull final SafeFunction<T> executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); T safeObserve( @Nonnull final Observer observer, @Nonnull final SafeFunction<T> observe ); T safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeFunction<T> observe,
@Nullable final Object[] parameters ); void action( @Nonnull final Procedure executable ); void action( @Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name, @Nonnull final Procedure executable ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void action( @Nullable final String name,
@Nonnull final Procedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void observe( @Nonnull final Observer observer, @Nonnull final Procedure observe ); void observe( @Nonnull final Observer observer,
@Nonnull final Procedure observe,
@Nullable final Object[] parameters ); void safeAction( @Nonnull final SafeProcedure executable ); void safeAction( @Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name, @Nonnull final SafeProcedure executable ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags ); void safeAction( @Nullable final String name,
@Nonnull final SafeProcedure executable,
@MagicConstant( flagsFromClass = ActionFlags.class ) final int flags,
@Nullable final Object[] parameters ); void safeObserve( @Nonnull final Observer observer, @Nonnull final SafeProcedure observe ); void safeObserve( @Nonnull final Observer observer,
@Nonnull final SafeProcedure observe,
@Nullable final Object[] parameters ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Disposable registerLocator( @Nonnull final Locator locator ); @OmitSymbol( unless = "arez.enable_references" ) @Nonnull Locator locator(); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void addObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @OmitSymbol( unless = "arez.enable_observer_error_handlers" ) void removeObserverErrorHandler( @Nonnull final ObserverErrorHandler handler ); @Nonnull Spy getSpy(); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.