View Javadoc

1   // -- FILE ------------------------------------------------------------------
2   // name       : AsnSimpleValueBase.java
3   // project    : Panter: LI
4   // created    : lep - 2007.01.16
5   // language   : java
6   // environment: JDK 1.5.0
7   // copyright  : (c) 2006 by Panter llc, Switzerland
8   // license    : this is free software licensed under the GPL. see COPYING
9   // --------------------------------------------------------------------------
10  package ch.panter.li.bi.asn.value;
11  
12  import ch.panter.li.bi.asn.AsnValueBase;
13  import ch.panter.li.bi.asn.model.AsnType;
14  
15  
16  public abstract class AsnSimpleValueBase extends AsnValueBase
17  {
18  
19    /* package protected */ AsnSimpleValueBase( final AsnType type )
20    {
21      super( checkTypeIsSimple( type ) );
22    } // AsnSimpleValueBase
23  
24    /* package protected */ AsnSimpleValueBase( final AsnSimpleValueBase copy )
25    {
26      super( copy );
27    } // AsnSimpleValueBase
28  
29    private static AsnType checkTypeIsSimple( final AsnType type )
30    {
31      if ( type == null ) {
32        throw new IllegalArgumentException( "type may not be null" );
33      }
34      if ( !type.isSimple() ) {
35        throw new IllegalArgumentException( "type '" + type + "' is complex but must be simple" );
36      }
37      return type;
38    } // checkTypeIsSimple
39  
40  } // class AsnSimpleValueBase
41  
42  // -- EOF -------------------------------------------------------------------