Home | History | Annotate | Download | only in impl
      1 /*
      2  * Copyright (C) 2009 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package signature.model.impl;
     18 
     19 import signature.model.IClassDefinition;
     20 import signature.model.IPackage;
     21 
     22 import java.io.Serializable;
     23 import java.util.Arrays;
     24 import java.util.List;
     25 import java.util.Set;
     26 
     27 @SuppressWarnings("serial")
     28 public class SigPackage extends SigAnnotatableElement implements IPackage,
     29         Serializable {
     30 
     31     private String name;
     32     private Set<IClassDefinition> classes = Uninitialized.unset();
     33 
     34     public SigPackage(String name) {
     35         this.name = name;
     36     }
     37 
     38     public String getName() {
     39         return name;
     40     }
     41 
     42     public List<String> getPackageFragments() {
     43         return Arrays.asList(name.split("\\."));
     44     }
     45 
     46     public Set<IClassDefinition> getClasses() {
     47         return classes;
     48     }
     49 
     50     public void setClasses(Set<IClassDefinition> classes) {
     51         this.classes = classes;
     52     }
     53 
     54     @Override
     55     public String toString() {
     56         StringBuilder builder = new StringBuilder();
     57         builder.append("package: ");
     58         builder.append(getName());
     59         return builder.toString();
     60     }
     61 }
     62