#' An S4 class to represent a web service
#'
#' @slot type The type of the web service
setClass (
Class = "WebService",
representation = representation(
type = "character"
),
validity = function(object){
cat("~~~ WebService: inspector ~~~ \n")
type <- object@type
if(length(object@type) != 1){
stop ("[WebService: validation] Only one type allowed")
}else{}
return(TRUE)
}
)
#*******************************************************
#CONSTRUCTOR
setMethod (
f="initialize",
signature="WebService",
definition=function(.Object,type){
#cat ("~~~~~ WebService: initializator ~~~~~ \n")
if(!missing(type)){
.Object@type <- type
validObject(.Object)# call of the inspector
}else{
.Object@type <- character(0)
}
return(.Object)
}
)
#CONSTRUCTOR (USER FRIENDLY)
webService <- function(type){
cat ("~~~~~ WebService: constructor ~~~~~ \n")
new (Class="WebService", type = type)
}
#*******************************************************
#ACCESSORS
setGeneric("getType",function(object){standardGeneric ("getType")})
setMethod("getType","WebService",
function(object){
return(object@type)
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.