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

com.github.joekerouac.common.tools.area.Area Maven / Gradle / Ivy

The newest version!
// Generated by delombok at Fri Mar 14 11:41:38 CST 2025
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
 * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
 * to You 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.github.joekerouac.common.tools.area;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 区域对象定义
 *
 * @author JoeKerouac
 * @date 2022-10-17 17:35
 * @since 2.0.0
 */
public class Area {
    /**
     * 默认区域代码,当没有父地区的时候使用该代码作为父区域代码
     */
    public static final String DEFAULT = "000000";
    /**
     * 当前地区代码
     */
    private String code;
    /**
     * 父地区代码
     */
    private String parent;
    /**
     * 地区名
     */
    private String name;
    /**
     * 子地区
     */
    private List childList;

    /**
     * 自己复制自己,deep copy
     * 
     * @return 复制结果
     */
    public Area copy() {
        Area area = new Area();
        area.code = code;
        area.parent = parent;
        area.name = name;
        area.childList = childList.stream().map(Area::copy).collect(Collectors.toList());
        return area;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public Area() {
    }

    /**
     * 当前地区代码
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public String getCode() {
        return this.code;
    }

    /**
     * 父地区代码
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public String getParent() {
        return this.parent;
    }

    /**
     * 地区名
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public String getName() {
        return this.name;
    }

    /**
     * 子地区
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public List getChildList() {
        return this.childList;
    }

    /**
     * 当前地区代码
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setCode(final String code) {
        this.code = code;
    }

    /**
     * 父地区代码
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setParent(final String parent) {
        this.parent = parent;
    }

    /**
     * 地区名
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setName(final String name) {
        this.name = name;
    }

    /**
     * 子地区
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setChildList(final List childList) {
        this.childList = childList;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public boolean equals(final java.lang.Object o) {
        if (o == this) return true;
        if (!(o instanceof Area)) return false;
        final Area other = (Area) o;
        if (!other.canEqual((java.lang.Object) this)) return false;
        final java.lang.Object this$code = this.getCode();
        final java.lang.Object other$code = other.getCode();
        if (this$code == null ? other$code != null : !this$code.equals(other$code)) return false;
        final java.lang.Object this$parent = this.getParent();
        final java.lang.Object other$parent = other.getParent();
        if (this$parent == null ? other$parent != null : !this$parent.equals(other$parent)) return false;
        final java.lang.Object this$name = this.getName();
        final java.lang.Object other$name = other.getName();
        if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
        final java.lang.Object this$childList = this.getChildList();
        final java.lang.Object other$childList = other.getChildList();
        if (this$childList == null ? other$childList != null : !this$childList.equals(other$childList)) return false;
        return true;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    protected boolean canEqual(final java.lang.Object other) {
        return other instanceof Area;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final java.lang.Object $code = this.getCode();
        result = result * PRIME + ($code == null ? 43 : $code.hashCode());
        final java.lang.Object $parent = this.getParent();
        result = result * PRIME + ($parent == null ? 43 : $parent.hashCode());
        final java.lang.Object $name = this.getName();
        result = result * PRIME + ($name == null ? 43 : $name.hashCode());
        final java.lang.Object $childList = this.getChildList();
        result = result * PRIME + ($childList == null ? 43 : $childList.hashCode());
        return result;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public java.lang.String toString() {
        return "Area(code=" + this.getCode() + ", parent=" + this.getParent() + ", name=" + this.getName() + ", childList=" + this.getChildList() + ")";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy