All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.fedora.client.console.ConsoleCommand Maven / Gradle / Ivy

Go to download

The Fedora Client is a Java Library that allows API access to a Fedora Repository. The client is typically one part of a full Fedora installation.

The newest version!
/*
 * -----------------------------------------------------------------------------
 *
 * 

License and Copyright: The contents of this file are subject to the * Apache License, Version 2.0 (the "License"); you may not use * this file except in compliance with the License. You may obtain a copy of * the License at * http://www.fedora-commons.org/licenses.

* *

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 entire file consists of original code.

*

Copyright © 2008 Fedora Commons, Inc.
*

Copyright © 2002-2007 The Rector and Visitors of the University of * Virginia and Cornell University
* All rights reserved.

* * ----------------------------------------------------------------------------- */ package fedora.client.console; import java.lang.reflect.Method; /** * *

Title: ConsoleCommand.java

*

Description:

* * @author [email protected] * @version $Id: ConsoleCommand.java 3965 2005-04-21 12:52:40Z rlw $ */ public class ConsoleCommand { Method m_method; String m_methodDescription; String[] m_paramNames; String[] m_paramDescriptions; String m_returnDescription; public ConsoleCommand(Method method, String methodDescription, String[] paramNames, String[] paramDescriptions, String returnDescription) { m_method=method; m_methodDescription=methodDescription; m_paramNames=paramNames; if (paramNames==null) { m_paramNames=new String[method.getParameterTypes().length]; for (int i=0; i0) { ret.append(", "); } ret.append(getUnqualifiedName(types[i])); ret.append(' '); ret.append(m_paramNames[i]); } ret.append(")"); return ret.toString(); } public String getUnqualifiedName(Class cl) { if (cl==null) { return "void"; } if (cl.getPackage()==null) { return bracketsForArrays(cl.getName()); } String pName=cl.getPackage().getName(); if ( (pName!=null) && (pName.length()>0) ) { return cl.getName().substring(pName.length()+1); } return bracketsForArrays(cl.getName()); } private String bracketsForArrays(String in) { if (in.equals("[B")) { return "byte[]"; } if (in.startsWith("[L")) { try { return getUnqualifiedName(Class.forName(in.substring(2, in.length()-1))) + "[]"; } catch (ClassNotFoundException cnfe) { System.out.println("class not found: " + in.substring(2, in.length()-1)); } } return in; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy