summaryrefslogtreecommitdiffstats
path: root/openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java
blob: 42eb5fd1e331be988e7c5ce40f8766b27c1208ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.woorea.openstack.base.client;

import java.io.InputStream;


public class Entity<T> {
	
	private T entity;
	
	private String contentType;
	
	public static <T> Entity<T> json(T entity) {
		return new Entity<T>(entity, "application/json");
	}
	
	public static <T> Entity<T> stream(T entity) {
		return new Entity<T>(entity, "application/octet-stream");
	}

	public Entity(T entity, String contentType) {
		super();
		this.entity = entity;
		this.contentType = contentType;
	}

	/**
	 * @return the entity
	 */
	public T getEntity() {
		return entity;
	}

	/**
	 * @param entity the entity to set
	 */
	public void setEntity(T entity) {
		this.entity = entity;
	}

	/**
	 * @return the contentType
	 */
	public String getContentType() {
		return contentType;
	}

	/**
	 * @param contentType the contentType to set
	 */
	public void setContentType(String contentType) {
		this.contentType = contentType;
	}
	
}