Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 //  The contents of this file are subject to the Mozilla Public License
 //  Version 1.1 (the "License"); you may not use this file except in
 //  compliance with the License. You may obtain a copy of the License
 //  at
 //  Software distributed under the License is distributed on an "AS IS"
 //  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 //  the License for the specific language governing rights and
 //  limitations under the License.
//  The Original Code is RabbitMQ.
//  The Initial Developer of the Original Code is VMware, Inc.
//  Copyright (c) 2007-2011 VMware, Inc.  All rights reserved.
Description of a JSON-RPC service.
public class ServiceDescription {
    public static final String JSON_RPC_VERSION = "1.1";

The service name
    public String name;
ID for the service
    public String id;
Version of the service
    public String version;
Human-readable summary for the service
    public String summary;
Human-readable instructions for how to get information on the service's operation
    public String help;

Map from procedure name to ProcedureDescription
    public ServiceDescription(Map<StringObjectrawServiceDescription) {
    public ServiceDescription(Class<?> klass) {
        this. = new HashMap<StringProcedureDescription>();
        for (Method mklass.getMethods()) {
            ProcedureDescription proc = new ProcedureDescription(m);
    public ServiceDescription() {
        // No work to do here

Gets a collection of all ProcedureDescription for this service
        return .values();

Private API - used via reflection during parsing/loading
    public void setProcs(Collection<Map<StringObject>> p) {
         = new HashMap<StringProcedureDescription>();
        for (Map<StringObjectpmp) {
            ProcedureDescription proc = new ProcedureDescription(pm);

Private API - used during initialization
    private void addProcedure(ProcedureDescription proc) {
        .put( + "/" + proc.arity(), proc);

Looks up a single ProcedureDescription by name and arity.

non-null ProcedureDescription if a match is found
java.lang.IllegalArgumentException if no match is found
    public ProcedureDescription getProcedure(String newnameint arity) {
        ProcedureDescription proc = .get(newname + "/" + arity);
        if (proc == null) {
            throw new IllegalArgumentException("Procedure not found: " + newname +
                                               ", arity " + arity);
        return proc;
New to GrepCode? Check out our FAQ X