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 java.io.Serializable; 20 import java.util.Collections; 21 import java.util.Set; 22 23 import signature.model.IAnnotatableElement; 24 import signature.model.IAnnotation; 25 26 @SuppressWarnings("serial") 27 public abstract class SigAnnotatableElement implements IAnnotatableElement, 28 Serializable { 29 private Set<IAnnotation> annotations; 30 31 public SigAnnotatableElement() { 32 annotations = Collections.emptySet(); 33 } 34 35 public Set<IAnnotation> getAnnotations() { 36 return annotations; 37 } 38 39 public void setAnnotations(Set<IAnnotation> annotations) { 40 this.annotations = annotations; 41 } 42 43 @Override 44 public String toString() { 45 StringBuilder builder = new StringBuilder(); 46 for (IAnnotation annotation : getAnnotations()) { 47 builder.append(annotation); 48 } 49 return builder.toString(); 50 } 51 } 52