com.openshift.internal.client.response.BaseResourceDTO Maven / Gradle / Ivy
/******************************************************************************* 
 * Copyright (c) 2012 Red Hat, Inc. 
 * Distributed under license by Red Hat, Inc. All rights reserved. 
 * This program is made available under the terms of the 
 * Eclipse Public License v1.0 which accompanies this distribution, 
 * and is available at http://www.eclipse.org/legal/epl-v10.html 
 * 
 * Contributors: 
 * Red Hat, Inc. - initial API and implementation 
 ******************************************************************************/
package com.openshift.internal.client.response;
import java.util.HashMap;
import java.util.Map;
import com.openshift.client.Messages;
/**
 * The Class BaseResourceDTO.
 * 
 * @param 
 *            the generic type
 */
public abstract class BaseResourceDTO {
	/** the indexed map of links to perform operations from this resource. */
	private final Map links;
	private final Messages messages;
	protected BaseResourceDTO() {
		this(new HashMap(), null);
	}
	/**
	 * Instantiates a new base resource dto.
	 * 
	 * @param links
	 *            the links
	 */
	protected BaseResourceDTO(final Map links, Messages messages) {
		this.links = links;
		this.messages = messages;
	}
	/**
	 * Gets the links.
	 * 
	 * @return all the links
	 */
	public final Map getLinks() {
		return links;
	}
	/**
	 * Gets the link.
	 * 
	 * @param name
	 *            the name of the link to look for.
	 * @return the named link
	 */
	public final Link getLink(String name) {
		return links.get(name);
	}
	/**
	 * Returns the messages that were reported when this resource was created.
	 * May be null if retrieved in a session in which we did not
	 * create this resource.
	 * 
	 * @return the messages that were reported when this resource was created
	 */
	public Messages getMessages() {
		return messages;
	}
}
         © 2015 - 2025 Weber Informatics LLC | Privacy Policy