referencepartimpl.java

来自「xbrlapi的源码」· Java 代码 · 共 45 行

JAVA
45
字号
package org.xbrlapi.impl;

import org.xbrlapi.FragmentList;
import org.xbrlapi.ReferencePart;
import org.xbrlapi.ReferencePartDeclaration;
import org.xbrlapi.utilities.Constants;
import org.xbrlapi.utilities.XBRLException;

/**
 * @author Geoffrey Shuetrim (geoff@galexy.net)
 */

public class ReferencePartImpl extends FragmentImpl implements ReferencePart {

    /**
     * Get the value of the reference part. 
     * @return The value of the reference part with spaces trimmed from
     * the front and end.
     * @throws XBRLException
     * @see org.xbrlapi.ReferencePart#getValue()
     */
    public String getValue() throws XBRLException {
    	return this.getDataRootElement().getTextContent().trim();
    }



    /**
     * @see org.xbrlapi.ReferencePart#getDeclaration()
     */
    public ReferencePartDeclaration getDeclaration() throws XBRLException {
    	String name = this.getLocalname();
    	String namespace = this.getNamespaceURI();
    	String query = "/"+ Constants.XBRLAPIPrefix+ ":" + "fragment[@type='org.xbrlapi.impl.ReferencePartDeclarationImpl' and "+ Constants.XBRLAPIPrefix+ ":" + "data/xsd:element/@name='" + name + "']";
    	FragmentList<ReferencePartDeclaration> declarations = getStore().<ReferencePartDeclaration>query(query);
    	for (ReferencePartDeclaration declaration: declarations) {
    		if (declaration.getTargetNamespaceURI().equals(namespace)) {
    			return declaration;
    		}
    	}
    	throw new XBRLException("The reference part has no corresponding declaration in the data store.");
    }
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?