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

com.bld.commons.classes.model.ModelSuperClass Maven / Gradle / Ivy

The newest version!
/**
 * @author Francesco Baldi
 * @mail [email protected]
 * @class bld.commons.classes.model.ModelSuperClass.java
 */
package com.bld.commons.classes.model;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.bld.commons.classes.generator.annotation.FindImport;
import com.bld.commons.classes.generator.utils.ClassGeneratorUtils;
import com.fasterxml.jackson.annotation.JsonProperty;

import jakarta.validation.constraints.NotNull;

/**
 * The Class ModelSuperClass.
 */
public class ModelSuperClass implements ModelComponentClass{

	/** The name. */
	@JsonProperty("super-class")
	@FindImport
	@NotNull
	private String name;

	/** The generic types. */
	@JsonProperty("generic-types")
	private List genericTypes;

	/**
	 * Instantiates a new model super class.
	 */
	public ModelSuperClass() {
		super();
		this.genericTypes = new ArrayList<>();
	}

	/**
	 * Gets the name.
	 *
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the name.
	 *
	 * @param name the new name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Gets the generic types.
	 *
	 * @return the generic types
	 */
	public List getGenericTypes() {
		return genericTypes;
	}

	/**
	 * Sets the generic types.
	 *
	 * @param genericTypes the new generic types
	 */
	public void setGenericTypes(List genericTypes) {
		this.genericTypes = genericTypes;
	}
	
	public void addGenericTypes(ModelGenericType... genericTypes) {
		ClassGeneratorUtils.addElements(this.genericTypes, genericTypes);
	}

	/**
	 * To string.
	 *
	 * @return the string
	 */
	@Override
	public String toString() {
		String genericType = "";
		for (ModelGenericType item : genericTypes)
				genericType += "," + item.getName();
		if(StringUtils.isNotEmpty(genericType))
			genericType="<"+genericType.substring(1)+">";
		return name + "" + genericType;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy