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

org.apache.maven.model.Resource Maven / Gradle / Ivy

The newest version!
// =================== DO NOT EDIT THIS FILE ====================
//  Generated by Modello Velocity from model-v3.vm
//  template, any modifications will be overwritten.
// ==============================================================
package org.apache.maven.model;

import java.io.Serializable;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.maven.api.annotations.Generated;
import org.apache.maven.api.annotations.Nonnull;

@Generated
public class Resource
    extends FileSet
    implements Serializable, Cloneable
{

    public Resource() {
        this(org.apache.maven.api.model.Resource.newInstance());
    }

    public Resource(org.apache.maven.api.model.Resource delegate) {
        this(delegate, null);
    }

    public Resource(org.apache.maven.api.model.Resource delegate, BaseObject parent) {
        super(delegate, parent);
    }

    public Resource clone(){
        return new Resource(getDelegate());
    }

    @Override
    public org.apache.maven.api.model.Resource getDelegate() {
        return (org.apache.maven.api.model.Resource) super.getDelegate();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || !(o instanceof Resource)) {
            return false;
        }
        Resource that = (Resource) o;
        return Objects.equals(this.delegate, that.delegate);
    }

    @Override
    public int hashCode() {
        return getDelegate().hashCode();
    }

    public String getTargetPath() {
        return getDelegate().getTargetPath();
    }

    public void setTargetPath(String targetPath) {
        if (!Objects.equals(targetPath, getTargetPath())) {
            update(getDelegate().withTargetPath(targetPath));
        }
    }

    public String getFiltering() {
        return getDelegate().getFiltering();
    }

    public void setFiltering(String filtering) {
        if (!Objects.equals(filtering, getFiltering())) {
            update(getDelegate().withFiltering(filtering));
        }
    }

    public String getMergeId() {
        return getDelegate().getMergeId();
    }

    public void setMergeId(String mergeId) {
        if (!Objects.equals(mergeId, getMergeId())) {
            update(getDelegate().withMergeId(mergeId));
        }
    }

    public InputLocation getLocation(Object key) {
        org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
        return loc != null ? new InputLocation(loc) : null;
    }

    public void setLocation(Object key, InputLocation location) {
        update(org.apache.maven.api.model.Resource.newBuilder(getDelegate(), true)
                        .location(key, location.toApiLocation()).build());
    }

    public InputLocation getImportedFrom() {
        org.apache.maven.api.model.InputLocation loc = getDelegate().getImportedFrom();
        return loc != null ? new InputLocation(loc) : null;
    }

    public void setImportedFrom(InputLocation location) {
        update(org.apache.maven.api.model.Resource.newBuilder(getDelegate(), true)
                        .importedFrom(location.toApiLocation()).build());
    }

    public Set getLocationKeys() {
        return getDelegate().getLocationKeys();
    }

    protected boolean replace(Object oldDelegate, Object newDelegate) {
        if (super.replace(oldDelegate, newDelegate)) {
            return true;
        }
        return false;
    }

    public static List resourceToApiV4(List list) {
        return list != null ? new WrapperList<>(list, Resource::getDelegate, Resource::new) : null;
    }

    public static List resourceToApiV3(List list) {
        return list != null ? new WrapperList<>(list, Resource::new, Resource::getDelegate) : null;
    }


            
    public boolean isFiltering() {
        return (getFiltering() != null) ? Boolean.parseBoolean(getFiltering()) : false;
    }
            
          

            
    public void setFiltering(boolean filtering) {
        setFiltering(String.valueOf(filtering));
    }
            
          

            
    /**
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return "Resource {targetPath: " + getTargetPath() + ", filtering: " + isFiltering() + ", " + super.toString() + "}";
    }
            
          
}