com.google.auto.factory.AutoFactory Maven / Gradle / Ivy
Show all versions of auto-factory Show documentation
/*
* Copyright (C) 2013 Google, Inc.
*
* 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 com.google.auto.factory;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Target;
/**
* An annotation to be applied to elements for which a factory should be automatically generated.
*
* Visibility
*
The visibility of the generated factories will always be either {@code public} or default
* visibility. The visibility of any given factory method is determined by the visibility of the
* type being created. The generated factory is {@code public} if any of the factory methods are.
* Any method that implements an interface method is necessarily public and any method that
* overrides an abstract method has the same visibility as that method.
*
* @author Gregory Kick
*/
@Target({ TYPE, CONSTRUCTOR })
public @interface AutoFactory {
/**
*/
String className() default "";
/**
* A list of interfaces that the generated factory is required to implement.
*/
Class>[] implementing() default { };
/**
* The type that the generated factory is require to extend.
*/
Class> extending() default Object.class;
}