Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * fb-contrib - Auxiliary detectors for Java programs
   * Copyright (C) 2009-2015 Jean-Noel Rouvignac
   * 
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Lesser General Public
   * License as published by the Free Software Foundation; either
   * version 2.1 of the License, or (at your option) any later version.
   * 
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  * 
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 package com.mebigfatguy.fbcontrib.utils;
 
Utility class for XClass and XMethod classes.
 
 public class XClassUtils {

Returns an XClass object for the given ClassDescriptor object.

Parameters:
classDesc the class descriptor for which to find the XClass object
Returns:
the class
Throws:
java.lang.AssertionError if the analysis of the class failed
 
 	public XClass getXClass(final ClassDescriptor classDescthrows AssertionError {
 		try {
 			return Global.getAnalysisCache().getClassAnalysis(XClass.class,
 					classDesc);
 		} catch (CheckedAnalysisException e) {
 			AssertionError ae = new AssertionError("Can't find ClassInfo for " + classDesc);
 			ae.initCause(e);
 			throw(ae);
 		}
 	}

Returns an XClass object for the given slashed class name.

Parameters:
slashedClassName the class name for which to find the XClass object
Returns:
the class
Throws:
java.lang.AssertionError if the analysis of the class failed
 
 	public XClass getXClass(String slashedClassName) {
 		return getXClass(DescriptorFactory
 				.createClassDescriptor(slashedClassName));
 	}

Looks for the method up the class hierarchy.

Parameters:
xClass the class where to look for the method
methodName the name of the method to look for
methodSig the signature of the method to look for
Returns:
the method
 
 	public XMethod getXMethod(final XClass xClassfinal String methodNamefinal String methodSig) {
 		if (xClass == null) {
 			return null;
 		}
 		
 		XMethod xMethod = xClass.findMethod(methodNamemethodSigfalse);
 		if (xMethod == null) {
 			final XClass superClass = getXClass(xClass
 			xMethod = getXMethod(superClassmethodNamemethodSig);
 		}
 		return xMethod;
 	}

Looks for the method up the class hierarchy.

Parameters:
slashedClassName the class slashed name where to look for the method
methodName the name of the method to look for
methodSig the signature of the method to look for
Returns:
the method
	public XMethod getXMethod(String slashedClassNameString methodNameString methodSig) {
		final XClass xClass = getXClass(slashedClassName);
		return getXMethod(xClassmethodNamemethodSig);
	}
New to GrepCode? Check out our FAQ X