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

org.deephacks.tools4j.config.Config Maven / Gradle / Ivy

There is a newer version: 0.15.0
Show newest version
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.deephacks.tools4j.config;

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

/**
 * 

* This annotation is used to mark a classes and fields as configurable and serves as a specification * of to express the structure, constraints and conditions under which instances can exist to * fulfill their intended purpose. Instances of configurable classes must always be unique * with respect to {@link Id}. *

*

* Changing configuration should never cause system failure or malfunctioning. Configurables should * therefore make sure that their properties have proper validation rules so that administrators * does not accidentally misconfigure the system. *

*

*

    *
  • Fields can be single-valued or multi-valued using any subclass of {@link java.util.Collection} type.
  • *
  • Fields can be any subclass of {@link java.util.Map} type, but this is only allowed for * referencing other {@link Config}, where key is the {@link Id} parameterized as {@link java.lang.String}.
  • *
  • Fields can be final in which case it is considered immutable.
  • *
  • Fields are not allowed to be transient.
  • *
  • Fields are not allowed to be non-final static.
  • *
  • Fields can reference other {@link Config} classes, single or multiple using any subclass of * {@link java.util.Collection} type.
  • *
  • Fields can have default values. These are used if no values have been set.
  • *

    * @author Kristoffer Sjogren */ @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE, ElementType.FIELD }) @Inherited public @interface Config { /** *

    * An informative name that clearly identifies the configuration in the system. * Good names are those which describe domain specific aspects already established * in the system architecture. *

    *

    * Names will be displayed to administrative users and must be unique within the * system. *

    * If no name is choosen the field or class name will picked instead. * * @return Name of the configurable. */ String name() default ""; /** * An informative description that justify the existence of the configuration, * putting it into context for how it relates to high-level system concepts and * ouline what it is used for and how changes affect the behaviour of * the system. *

    * Descriptions will be displayed to administrative users. *

    * @return A description. */ String desc() default ""; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy