All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.memority.toolkit.rule.api.JavaRule Maven / Gradle / Ivy

Go to download

This artifact provides the API classes that are necessary to implement the contracts of Memority configuration Rules.

There is a newer version: 3.43.1
Show newest version
/*
 * Copyright (c) 2016-2023 Memority. All Rights Reserved.
 *
 * This file is part of Memority Toolkit API , a Memority project.
 *
 * This file is released under the Memority Public Artifacts End-User License Agreement,
 * see 
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 */
package com.memority.toolkit.rule.api;

import com.memority.toolkit.rule.api.Rule;
import com.memority.toolkit.rule.api.RuleCategory;
import com.memority.toolkit.rule.api.RuleConfiguration;
import com.memority.toolkit.rule.api.RuleType;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Used on Java Rule implementations to declare and register them with the Rules management services.
 * 

* The application must be configured to scan the packages that will contain JavaRules, for this be picked up. */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JavaRule { /** * The rule label, that must be unique amongst all rules and is used to perform i18n lookup by convention. * Must be a simple alphanumerical string with camelCase separation. Convention is to begin with the rule type. *

Example:

*
    *
  • conditionUserType
  • *
  • validationEmail
  • *
  • computeRandomId
  • *
*

Multiple labels can be given to support migration from one label to another and/or provide simple aliases. However, the * first label is always considered the 'canonical' one and the unicity constraint remains amongst all registered rules.

* * @return the label */ String[] label(); /** * The rule type, that provides the rule function signature. * * @return the type */ RuleType type(); /** * The rule category. Maybe ANY (the default) if the rule is simple and can be used in any context. * * @return the category */ String category() default RuleCategory.ANY_NAME; /** * The rule configuration class. This is optional as the rule may be non configurable. * * @return the configuration class */ Class configuration() default RuleConfiguration.class; /** * The rule implementation class. If neither this nor the ruleClassName is set, then the annotated * class is used. * * As an alternative, when the class is not on the classpath, use ruleClassName. * * @return the rule class */ Class ruleClass() default Rule.class; /** * The rule implementation class name. If neither this nor the ruleClass is set, then the annotated * class is used. * * As an alternative, if the class is on the classpath, use ruleClass. * * @return the rule class name */ String ruleClassName() default ""; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy