asn1genericid.java
来自「CmisJavaApi」· Java 代码 · 共 152 行
JAVA
152 行
/* * The contents of this file are subject to the Dyade Public License, * as defined by the file DYADE_PUBLIC_LICENSE.TXT * * You may not use this file except in compliance with the License. You may * obtain a copy of the License on the Dyade web site (www.dyade.fr). * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific terms governing rights and limitations under the License. * * The Original Code is CmisJava API, including the java package * fr.dyade.cmis, released September 5, 2000. * * The Initial Developer of the Original Code is Dyade. The Original Code and * portions created by Dyade are Copyright Bull and Copyright INRIA. * All Rights Reserved. *//* Copyright 1996-2000 by Institut National de Recherche en Informatique * et en Automatique (INRIA) * All rights reserved. See COPYRIGHT in top-level directory. * * Authors: Laurent Andrey, Eric Dillon, Olivier Festor *///// $Id: ASN1GenericID.java,v 1.2 2000/09/05 13:30:24 festor Exp $// $Source: /local/resedas/CVS-Repository/CmisJavaApi/src/fr/dyade/cmis/api/types/ASN1GenericID.java,v $//// Todo//package fr.dyade.cmis.api.types;// Java related packagesimport java.lang.*;/** * Since most ASN.1 ID are based on the use of a Global or a Local form, * this genericID implements it. * <p> * Basically, this class enables the creation of two kinds of ID : * <menu> * <li> using a <tt>GlobalForm</tt>, i.e. by using a <oode>ObjectIdentifier</code>, * <li> or, using a <tt>LocalForm</tt>, i.e. by using an <code>integer<code> * </menu> * * This is an abstract class, see specialized ID classes. * @see fr.dyade.cmis.api.types.ActionTypeId * @see fr.dyade.cmis.api.types.AttributeId * @see fr.dyade.cmis.api.types.EventTypeId * @see fr.dyade.cmis.api.types.ObjectClass * * Known problem: some of the derived class are "true" asn1 Value case with * proper value type code (EventTypeId, ObjectClass) but NOT the other (ActionTypeId, AttributeId) * @version $Id: ASN1GenericID.java,v 1.2 2000/09/05 13:30:24 festor Exp $ */public abstract class ASN1GenericID extends Value { /** * Create a new instance of ASN1GenericID using a "GlobalFormID" by giving the corresponding ObjectIdentifier. * @param pGlobalForm The ObjectIdentifier to use to build the ASN1GenericID */ protected ASN1GenericID(short pValueType, ObjectIdentifier pGlobalForm) { super(pValueType); fFormType = ASN1GENERICID_GLOBAL_FORM; fGlobalForm = pGlobalForm; } /** * Create a new instance of ASN1GenericID using a "LocalFormID" by giving the corresponding int. * @param pLocalForm The integer value to use to build the corresponding ASN1GenericID. */ protected ASN1GenericID(short pValueType, int pLocalForm) { super(pValueType); fFormType = ASN1GENERICID_LOCAL_FORM; fLocalForm = pLocalForm; } /** Create a new instance of ASN1GenericID by its global form from a OID in dotted string notation. * @param pValueType value tag as ASN1GenericID is derived from Value * @param pOidStr the OID in dotted string notation form. */ protected ASN1GenericID(short pValueType, String pOidStr) { this(pValueType, new ObjectIdentifier(pOidStr)); } /** * Returns the current "formType" of the Generic Identifier. */ public int getFormType() { return fFormType; } /** * Returns the localform of the Identifier, i.e. an integer value. * @return The integer value of the localForm <code>ASN1GenericID</code>. */ public int getIDLocal() { return fLocalForm; } /** * Returns the globalform of the Identifier, i.e. an <code>ObjectIdentifier</code> object. * @return The <code>ObjectIdentifier</code> corresponding to the GlobalForm <code>ASN1GenericID</code>. */ public ObjectIdentifier getIDGlobal() { return fGlobalForm; } /** Change the current id to a global one. * @param oid the object identifier to use as global identifier (must not be null) */ public void setIDGlobal(ObjectIdentifier oid) { fFormType=ASN1GENERICID_GLOBAL_FORM; fGlobalForm=oid; } /** * Returns a String copy of the Identifier, whatever is form. * @return A <code>String</code> representation of the <code>ASN1GenericID</code> */ public String toString() { if (fFormType == ASN1GENERICID_GLOBAL_FORM) return fGlobalForm.toString(); return Integer.toString(fLocalForm); } /** * To compare two ASN1 Generic IDs * @return true both ASN1GenericIDs hold the same Identifier. */ public boolean equals(ASN1GenericID pID) { if (pID.fFormType == fFormType){ if (fFormType == ASN1GENERICID_GLOBAL_FORM) return fGlobalForm.equals(pID.getIDGlobal()); if (fFormType == ASN1GENERICID_LOCAL_FORM) return (fLocalForm == pID.getIDLocal()); } return false; } // Two fields appear: protected int fLocalForm; protected ObjectIdentifier fGlobalForm; // The form type protected short fFormType; // Both types identifiers public static final short ASN1GENERICID_GLOBAL_FORM = 0; public static final short ASN1GENERICID_LOCAL_FORM = 1;} // ASN1GenericID
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?