func (t Type) String() string {
	switch t {
	case EntityApplication:
		return "Application"
	case EntityReplicationController:
		return "ReplicationController"
	case EntityPod:
		return "Pod"
	case EntityContainer:
		return "Container"
	case EntityImage:
		return "Image"
	default:
		return ""
	}
}
String prints the name of the type
package entity
import (
	"errors"
	"fmt"
	"rsprd.com/spread/pkg/deploy"
	kube "k8s.io/kubernetes/pkg/api"
)
type Entity interface {
	deploy.Deployable
	Type() Type
	Objects() []deploy.KubeObject
	Source() string
	Attach(Entity) error
	DefaultMeta() kube.ObjectMeta
	name() string
	children() []Entity
}
type Builder interface {
	Build() (Entity, error)
}
type base struct {
	entityType Type
	objects    deploy.Deployment
	source     string
	defaults   kube.ObjectMeta
}
func newBase(t Type, defaults kube.ObjectMeta, source string, objects []deploy.KubeObject) (base base, err error) {
	base.defaults = defaults
	deployment := deploy.Deployment{}
	for _, obj := range objects {
		if obj == nil {
			err = ErrorNilObject
			return
		}
		base.setDefaults(obj)
		err = deployment.Add(obj)
		if err != nil {
			err = fmt.Errorf("error adding '%s': %v", source, err)
			return
		}
	}
	base.source = source
	base.entityType = t
	base.objects = deployment
	return
}
func (base base) Objects() []deploy.KubeObject {
	return base.objects.Objects()
}
func (base base) Source() string {
	return base.source
}
func (base base) DefaultMeta() kube.ObjectMeta {
	return base.defaults
}
func (base base) Type() Type {
	return base.entityType
}
func (base base) validAttach(e Entity) error {
	if e == nil {
		return ErrorNilEntity
	}
	if e.Type() > EntityImage {
		return ErrorInvalidAttachType
	} else if base.Type() > e.Type() {
		return ErrorBadAttachOrder
	}
	return nil
}
func (base base) setDefaults(obj deploy.KubeObject) {
	setMetaDefaults(obj, base.defaults)
}
type Type int
const (
	EntityApplication Type = iota
	EntityReplicationController
	EntityPod
	EntityContainer
	EntityImage
)