/** * Returns the Java package in the context of which the construct is defined. * @return */ @Override public JavaPackageId getJavaPackageId() { if(this.isNested()) return this.declarationContext.getJavaPackageId(); else return (JavaPackageId)this.declarationContext; } }
/** * Returns a class name that is unique within the package in which the class is defined. * In case of nested classes, the names of parent classes will be included (e.g., OuterClass$InnerClass). * @returns the class name including the names of parent classes (if any) */ @Override public String getName() { if(this.declarationContext!=null) { if(!this.isNested()) return this.enumName; else return this.declarationContext.getName() + "$" + this.enumName; } else { return this.enumName; } }
/** * Returns the fully qualified class name, i.e., including the name of the package in which the class is defined. */ @Override public String getQualifiedName() { if(this.declarationContext!=null) { if(!this.isNested()) return this.declarationContext.getQualifiedName() + "." + this.enumName; else return this.declarationContext.getQualifiedName() + "$" + this.enumName; } else { return this.enumName; } }
/** * * @param _jid * @return */ private JavaId getCompilationUnit(JavaId _jid) { // Got it --> return provided object if( (_jid.getType().equals(JavaId.Type.CLASS) && !((JavaClassId)_jid).isNestedClass()) || (_jid.getType().equals(JavaId.Type.INTERFACE) && !((JavaInterfaceId)_jid).isNested()) || (_jid.getType().equals(JavaId.Type.ENUM) && !((JavaEnumId)_jid).isNested()) ) { return _jid; } else { return this.getCompilationUnit((JavaId)_jid.getDefinitionContext()); } }