diff options
Diffstat (limited to 'openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java')
-rw-r--r-- | openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java new file mode 100644 index 0000000..42eb5fd --- /dev/null +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/Entity.java @@ -0,0 +1,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; + } + +} |