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

cn.wjybxx.dson.codec.CodecLinker Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
/*
 * Copyright 2023-2024 wjybxx([email protected])
 *
 * 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 cn.wjybxx.dson.codec;

import java.lang.annotation.*;

/**
 * 主要用于为引入的外部库中的Bean自动生成Codec。
 * 1.字段的类型就是我们要自动生成Codec的类型,泛型等信息会被忽略
 * 2.仅适用简单的Bean,复杂的Bean还是需要用户自行实现。
 * 2.1 必须包含无参构造函数;
 * 2.2 transient字段将被忽略;
 * 2.3 要序列化的字段必须包含getter/setter;
 *
 * @author wjybxx
 * date - 2023/12/10
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.SOURCE)
public @interface CodecLinker {

    /**
     * 为类型附加的信息
     * 大致语法:
     * 
{@code
     *      @CodecLinker(classImpl = @ClassImpl)
     * }
*/ ClassImpl classImpl(); /** * 子目录 * 1.与{@link CodecLinkerGroup#outputPackage()}构成最终包路径。 * 2.另一种方案是,每个子包使用一个静态内部来引用 */ String subPackage() default ""; /** 为生成的文件添加的注解 */ Class[] annotations() default {}; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy