本文整理汇总了Java中javassist.bytecode.ClassFile.isInterface方法的典型用法代码示例。如果您正苦于以下问题:Java ClassFile.isInterface方法的具体用法?Java ClassFile.isInterface怎么用?Java ClassFile.isInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javassist.bytecode.ClassFile
的用法示例。
在下文中一共展示了ClassFile.isInterface方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transform
import javassist.bytecode.ClassFile; //导入方法依赖的package包/类
/**
* Transform the class defined by the given ClassFile descriptor. The ClassFile descriptor itself is mutated
*
* @param classFile The class file descriptor
*
* @throws Exception Indicates a problem performing the transformation
*/
public void transform(ClassFile classFile) throws Exception {
if ( classFile.isInterface() ) {
return;
}
try {
addFieldHandlerField( classFile );
addGetFieldHandlerMethod( classFile );
addSetFieldHandlerMethod( classFile );
addFieldHandledInterface( classFile );
addReadWriteMethods( classFile );
transformInvokevirtualsIntoPutAndGetfields( classFile );
}
catch (CannotCompileException e) {
throw new RuntimeException( e.getMessage(), e );
}
}
示例2: getClassName
import javassist.bytecode.ClassFile; //导入方法依赖的package包/类
public String getClassName(String name, InputStream stream) throws IOException {
// NOTE package-info.class should be excluded
if (!name.endsWith(".class") || name.contains("-"))
return null;
DataInputStream dstream = new DataInputStream(stream);
try {
ClassFile cf = new ClassFile(dstream);
if (!cf.isInterface() && !isAnnotationPresent(cf)) {
// behaviour that implements a concept
for (String fname : cf.getInterfaces()) {
String cn = fname.replace('.', '/') + ".class";
InputStream in = cl.getResource(cn).openStream();
try {
if (super.getClassName(cn, in) != null)
return cf.getName();
} finally {
in.close();
}
}
}
} finally {
dstream.close();
stream.close();
}
return null;
}
示例3: transform
import javassist.bytecode.ClassFile; //导入方法依赖的package包/类
public void transform(ClassFile classfile) throws Exception {
if (classfile.isInterface()) {
return;
}
try {
addFieldHandlerField(classfile);
addGetFieldHandlerMethod(classfile);
addSetFieldHandlerMethod(classfile);
addFieldHandledInterface(classfile);
addReadWriteMethods(classfile);
transformInvokevirtualsIntoPutAndGetfields(classfile);
} catch (CannotCompileException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
示例4: getClasses
import javassist.bytecode.ClassFile; //导入方法依赖的package包/类
public Set<JClass> getClasses() throws ClasspathAccessException {
Set<JClass> retVal = new HashSet<JClass>();
List<? extends ClassFile> classes = getResolver().getClassFileResolver().resolveAll(null, CLASSPATH_PROJECTOR, new PackageFileFilter(getName(), false), new PackagePrefixFilter(this), new JElementTypeFilter(JClass.class));
for (ClassFile classFile : classes) {
if ((classFile.getSuperclass() != null) &&
(!classFile.isInterface() && (!classFile.getSuperclass().equals("java.lang.Enum"))
&& (classFile.getInnerAccessFlags() == -1))) {
retVal.add(JClass.getJClass(classFile, getResolver()));
}
}
return retVal;
}
示例5: getInterfaces
import javassist.bytecode.ClassFile; //导入方法依赖的package包/类
public Set<JInterface> getInterfaces() throws ClasspathAccessException {
Set<JInterface> retVal = new HashSet<JInterface>();
List<? extends ClassFile> classes = getResolver().getClassFileResolver().resolveAll(null, CLASSPATH_PROJECTOR, new PackageFileFilter(getName(), false), new PackageFilter(this), new JElementTypeFilter(JInterface.class));
for (ClassFile classFile : classes) {
if (classFile.isInterface() && (!classFile.getSuperclass().equals("java.lang.annotation.Annotation"))) {
retVal.add(JInterface.getJInterface(classFile, getResolver()));
}
}
return retVal;
}
示例6: scanClass
import javassist.bytecode.ClassFile; //导入方法依赖的package包/类
/**
* Overrides the superclass' implementation to track the
* {@link ClassFile} being scanned.
*
* @see #populate(Annotation[], ClassFile)
*/
@Override
protected final void scanClass(final ClassFile cf) {
// Overrides this method to keep track of the ClassFile being scanned.
if (cf == null || !cf.isInterface()) {
this.cf = cf;
} else {
this.cf = null;
}
super.scanClass(cf);
this.cf = null;
}
示例7: scanMethods
import javassist.bytecode.ClassFile; //导入方法依赖的package包/类
/**
* Overrides the superclass' implementation to track the
* {@link ClassFile} being scanned.
*
* @see #populate(Annotation[], ClassFile)
*/
@Override
protected final void scanMethods(final ClassFile cf) {
// Overrides this method to keep track of the ClassFile being scanned.
if (cf == null || !cf.isInterface()) {
this.cf = cf;
} else {
this.cf = null;
}
super.scanMethods(cf);
this.cf = null;
}
示例8: scanFields
import javassist.bytecode.ClassFile; //导入方法依赖的package包/类
/**
* Overrides the superclass' implementation to track the
* {@link ClassFile} being scanned.
*
* @see #populate(Annotation[], ClassFile)
*/
@Override
protected final void scanFields(final ClassFile cf) {
// Overrides this method to keep track of the ClassFile being scanned.
if (cf == null || !cf.isInterface()) {
this.cf = cf;
} else {
this.cf = null;
}
super.scanFields(cf);
this.cf = null;
}
示例9: JInterface
import javassist.bytecode.ClassFile; //导入方法依赖的package包/类
protected JInterface(ClassFile classFile, ClasspathResolver resolver) {
super(classFile, resolver);
if (!classFile.isInterface() || (classFile.getSuperclass().equals("java.lang.annotation.Annotation"))) {
throw new IllegalArgumentException("Argument was not interface: " + classFile.getName());
}
}