本文整理汇总了Java中org.apache.bcel.util.Repository类的典型用法代码示例。如果您正苦于以下问题:Java Repository类的具体用法?Java Repository怎么用?Java Repository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Repository类属于org.apache.bcel.util包,在下文中一共展示了Repository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createClassSet
import org.apache.bcel.util.Repository; //导入依赖的package包/类
public static JavaType[] createClassSet( File classes, ClassLoader thirdPartyClasses, ClassFilter classFilter )
throws MalformedURLException
{
ClassLoader classLoader = new URLClassLoader( new URL[]{ classes.toURI().toURL() }, thirdPartyClasses );
Repository repository = new ClassLoaderRepository( classLoader );
List selected = new ArrayList();
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( classes );
scanner.setIncludes( new String[]{ "**/*.class" } );
scanner.scan();
String[] files = scanner.getIncludedFiles();
for ( int i = 0; i < files.length; i++ )
{
File f = new File( classes, files[i] );
JavaClass clazz = extractClass( f, repository );
if ( classFilter.isSelected( clazz ) )
{
selected.add( new BcelJavaType( clazz ) );
repository.storeClass( clazz );
}
}
JavaType[] ret = new JavaType[selected.size()];
selected.toArray( ret );
return ret;
}
示例2: extractClass
import org.apache.bcel.util.Repository; //导入依赖的package包/类
private static JavaClass extractClass( File f, Repository repository )
throws CheckerException
{
InputStream is = null;
try
{
is = new FileInputStream( f );
ClassParser parser = new ClassParser( is, f.getName() );
JavaClass clazz = parser.parse();
clazz.setRepository( repository );
return clazz;
}
catch ( IOException ex )
{
throw new CheckerException( "Cannot read " + f, ex );
}
finally
{
IOUtil.close( is );
}
}
示例3: storeClass
import org.apache.bcel.util.Repository; //导入依赖的package包/类
public void storeClass(JavaClass javaClass) {
if (DEBUG)
System.out.println("Storing class " + javaClass.getClassName() + " in repository");
JavaClass previous = nameToClassMap.put(javaClass.getClassName(), javaClass);
if (DEBUG && previous != null) {
System.out.println("\t==> A previous class was evicted!");
dumpStack();
}
Repository tmp = org.apache.bcel.Repository.getRepository();
if (tmp != null && tmp != this)
throw new IllegalStateException("Wrong/multiple BCEL repository");
if (tmp == null)
org.apache.bcel.Repository.setRepository(this);
}
示例4: getSuperClasses
import org.apache.bcel.util.Repository; //导入依赖的package包/类
private ArrayList<String> getSuperClasses(Repository repository, JavaClass implem) {
ArrayList<String> result = new ArrayList<String>();
String superName = null;
while ((superName = implem.getSuperclassName()) != null) {
if (result.contains(superName))
break;
result.add(superName);
try {
implem = repository.loadClass(superName);
} catch (ClassNotFoundException e) {
implem = null;
}
}
return result;
}
示例5: isCompatible
import org.apache.bcel.util.Repository; //导入依赖的package包/类
@Override
public boolean isCompatible(Repository repository, InputModel input) {
if (input == null) {
return false;
}
return input.isCompatible(repository, this);
}
示例6: ClassScanner
import org.apache.bcel.util.Repository; //导入依赖的package包/类
/**
* Initializes a new scanner.
*
* @param repository
* the Repository to use for loading classes. Must not be <code>null</code>.
* @param filter
* the filter to use. Must not be <code>null</code>.
*/
public ClassScanner(final Repository repository, final ClassFilter filter) {
if (repository == null) {
throw new IllegalArgumentException("repository must not be null");
}
if (filter == null) {
throw new IllegalArgumentException("filter must not be null");
}
this.repository = repository;
this.filter = filter;
}
示例7: operateOn
import org.apache.bcel.util.Repository; //导入依赖的package包/类
@Override
public final void operateOn(final ClassGen classGen, final JavaClass clazz, final Repository repository) {
System.out.println(plugin.getClass().getName() + ": Transforming type " + clazz.getClassName());
plugin.operateOn(classGen, clazz, repository);
}
示例8: operateOn
import org.apache.bcel.util.Repository; //导入依赖的package包/类
@Override
public final void operateOn(final ClassGen classGen, final JavaClass clazz, final Repository repository) {
// Do nothing
}
示例9: getRepository
import org.apache.bcel.util.Repository; //导入依赖的package包/类
public final Repository getRepository() {
return repository;
}
示例10: SynchronizedBCELRepository
import org.apache.bcel.util.Repository; //导入依赖的package包/类
public SynchronizedBCELRepository(final Repository realRepository) {
this.realRepository = realRepository;
}
示例11: FunctionBlockClass
import org.apache.bcel.util.Repository; //导入依赖的package包/类
/**
* Initializes a new FunctionBlockClass. This should normally not be called directly, instead use a
* {@link FunctionBlockClassFactory}.
*
* @param repository
* the Repository that should be used to load the class
* @param className
* the name of the class
* @throws ClassNotFoundException
* if the class is not found
* @throws IllegalArgumentException
* if the class is not a {@link FunctionBlock}
*/
public FunctionBlockClass(final Repository repository, final String className) throws ClassNotFoundException {
this.repository = repository;
this.blockClass = repository.loadClass(className);
if (!isFunctionBlock(blockClass)) {
throw new IllegalArgumentException("not a FunctionBlock class: " + className);
}
}
示例12: isCompatible
import org.apache.bcel.util.Repository; //导入依赖的package包/类
/**
* Checks if an {@link Input} is compatible with this Output. An Input is compatible if it takes either the type
* this Output sends or any supertype of it.
*
* @param repository
* the Repository used for inspecting the classes
* @param input
* the Input to check
* @return true if the input is compatible
*/
boolean isCompatible(Repository repository, InputModel input);
示例13: isCompatible
import org.apache.bcel.util.Repository; //导入依赖的package包/类
/**
* Checks if an {@link Output} is compatible with this Input. An Output is compatible if it sends the type this
* Input takes or any subtype of it
*
* @param repository
* the Repository used for inspecting the classes
* @param output
* the Output to check
* @return true if the output is compatible
*/
boolean isCompatible(Repository repository, OutputModel output);
示例14: FunctionBlockClassFactory
import org.apache.bcel.util.Repository; //导入依赖的package包/类
/**
* Initializes a new FunctionBlockClassFactory with the given Repository. This factory will only be thread-safe if
* the Repository is not accessed at the same time as methods on this Factory are called.
*
* @param repository
* the Repository to use for loading classes
*/
public FunctionBlockClassFactory(final Repository repository) {
this.repository = new SynchronizedBCELRepository(repository);
}
示例15: operateOn
import org.apache.bcel.util.Repository; //导入依赖的package包/类
void operateOn(ClassGen classGen, JavaClass clazz, Repository repository);