001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.marshall.plaintext; 018 019import static org.apache.juneau.commons.utils.Shorts.*; 020 021import java.lang.annotation.*; 022 023import org.apache.juneau.commons.*; 024 025/** 026 * Utility classes and methods for the {@link PlainText @PlainText} annotation. 027 * 028 */ 029public class PlainTextAnnotation { 030 031 /** 032 * Prevents instantiation. 033 */ 034 private PlainTextAnnotation() {} 035 /** 036 * Builder class. 037 * 038 * <h5 class='section'>See Also:</h5><ul> 039 * <li class='jm'>{@link org.apache.juneau.marshall.MarshallingContext.Builder#annotations(Annotation...)} 040 * </ul> 041 */ 042 public static class Builder extends AnnotationObject.Builder { 043 044 private String[] description = {}; 045 046 /** 047 * Constructor. 048 */ 049 protected Builder() { 050 super(PlainText.class); 051 } 052 053 /** 054 * Instantiates a new {@link PlainText @PlainText} object initialized with this builder. 055 * 056 * @return A new {@link PlainText @PlainText} object. 057 */ 058 public PlainText build() { 059 return new Object(this); 060 } 061 062 /** 063 * Sets the description property on this annotation. 064 * 065 * @param value The new value for this property. 066 * @return This object. 067 */ 068 public Builder description(String...value) { 069 description = value; 070 return this; 071 } 072 } 073 074 @SuppressWarnings({ 075 "java:S2160" // equals() inherited from AnnotationObject compares all annotation interface methods; subclass fields are accessed via those methods 076 }) 077 private static class Object extends AnnotationObject implements PlainText { 078 079 private final String[] description; 080 081 Object(PlainTextAnnotation.Builder b) { 082 super(b); 083 this.description = cp(b.description); 084 } 085 086 @Override /* Overridden from annotation */ 087 public String[] description() { 088 return description; 089 } 090 } 091 092 /** Default value */ 093 public static final PlainText DEFAULT = create().build(); 094 095 /** 096 * Instantiates a new builder for this class. 097 * 098 * @return A new builder object. 099 */ 100 public static Builder create() { 101 return new Builder(); 102 } 103}