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

com.kazurayam.ks.globalvariable.xml.GlobalVariableEntities.groovy Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package com.kazurayam.ks.globalvariable.xml

public final class GlobalVariableEntities {

	private String description
	private String name
	private String tag
	private Boolean defaultProfile
	private List entities

	GlobalVariableEntities() {
		this.description = ""
		this.name = ""
		this.tag = ""
		this.defaultProfile = false
		this.entities = new ArrayList()
	}

	GlobalVariableEntities description(String description) {
		this.description = description ?: ""
		return this
	}

	GlobalVariableEntities name(String name) {
		this.name = name ?: ""
		return this
	}

	GlobalVariableEntities tag(String tag) {
		this.tag = tag ?: ""
		return this
	}

	GlobalVariableEntities defaultProfile(Boolean defaultProfile) {
		this.defaultProfile = defaultProfile
		return this
	}

	GlobalVariableEntities addEntity(GlobalVariableEntity entity) {
		this.entities.add(entity)
		return this
	}

	String description() {
		return description
	}

	String name() {
		return name
	}

	String tag() {
		return tag
	}

	Boolean defaultProfile() {
		return defaultProfile
	}

	List entities() {
		return new ArrayList(entities)
	}

	boolean contains(String globalVariableName) {
		int count = 0
		for (GlobalVariableEntity gve in this.entities) {
			if (gve.name() == globalVariableName) {
				count += 1
			}
		}
		return count > 0
	}

	@Override
	String toString() {
		StringBuilder sb = new StringBuilder()
		sb.append("")
		sb.append("${description}")
		sb.append("${name}")
		sb.append("${tag}")
		sb.append("${defaultProfile}")
		entities.each { entity ->
			sb.append(entity.toString())
		}
		sb.append("")
		return sb.toString()
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy