Example usage for org.eclipse.jdt.internal.compiler.classfmt ClassFileReader getSourceName

List of usage examples for org.eclipse.jdt.internal.compiler.classfmt ClassFileReader getSourceName

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.classfmt ClassFileReader getSourceName.

Prototype

@Override
    public char[] getSourceName() 

Source Link

Usage

From source file:org.eclipse.wst.xml.core.internal.contentmodel.tapestry.travelpackage.TapestryClassLoader.java

License:Open Source License

public TapestryCoreComponents loadComponentAttributesFromClassFile(IPackageFragmentRoot fragmentRoot,
        String prefix, ClassFile packi) throws JavaModelException, ClassFormatException {
    ClassFileReader reader = new ClassFileReader(packi.getBytes(), null);
    TapestryCoreComponents component = new TapestryCoreComponents();
    component.setName(String.valueOf(reader.getSourceName()));
    component.setElementLabel(prefix + ":" + component.getName().toLowerCase());
    if (reader.getFields() != null)
        for (IBinaryField field : reader.getFields()) {
            boolean parameter = false;
            if (field.getAnnotations() == null)
                continue;
            for (IBinaryAnnotation anno : field.getAnnotations()) {
                if (String.valueOf(anno.getTypeName()).endsWith("/Parameter;")) {
                    parameter = true;//from   ww w .  j a  v  a 2s  .  com
                    break;
                }
            }
            if (parameter) {
                component.addParameter(String.valueOf(field.getName()));
            }
        }

    String parentClassName = String.valueOf(reader.getSuperclassName());
    if (parentClassName != null && !parentClassName.isEmpty() && !parentClassName.equals("java/lang/Object")) {
        List<String> parameters = loadParametersFromParentClass(fragmentRoot, parentClassName);
        for (String parameter : parameters) {
            component.addParameter(parameter);
        }
    }

    return component;
}

From source file:org.springframework.ide.eclipse.core.java.TypeStructure.java

License:Open Source License

public TypeStructure(ClassFileReader cfr) {
    //It shouldn't really matter what arguments we provide to the constructor
    // since this class implements all the methods, except for getTypeAnnotations,
    // which just returns 'null'. So all that really matters is we pass in 
    // something that doesn't make the super constructor crash. We will nevertheless
    // try our best to pass in sensible values.
    super(cfr.getModifiers(), computeQualification(cfr), cfr.getSourceName(), cfr.getEnclosingTypeName(),
            (char[][]) null, '?' //?? appears not used in super class, so not sure what its for
    );//from   w  w w .  j  a v a 2  s  .  c  o  m

    this.enclosingTypeName = cfr.getEnclosingTypeName();
    this.isLocal = cfr.isLocal();
    this.isAnonymous = cfr.isAnonymous();
    this.isMember = cfr.isMember();
    this.sourceFileName = cfr.sourceFileName();
    this.fileName = cfr.getFileName();
    this.tagBits = cfr.getTagBits();
    this.isBinaryType = cfr.isBinaryType();
    this.binFields = cfr.getFields();
    if (binFields == null)
        binFields = NoField;
    this.binMethods = cfr.getMethods();
    if (binMethods == null)
        binMethods = NoMethod;
    this.memberTypes = cfr.getMemberTypes();
    this.annotations = cfr.getAnnotations();
    this.sourceName = cfr.getSourceName();
    this.className = cfr.getName(); // slashes...
    this.modifiers = cfr.getModifiers();
    this.genericSignature = cfr.getGenericSignature();
    // if (this.genericSignature.length == 0) {
    // this.genericSignature = null;
    // }
    this.superclassName = cfr.getSuperclassName(); // slashes...
    interfaces = cfr.getInterfaceNames();

}