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.uon; 018 019import static org.apache.juneau.commons.utils.Shorts.*; 020 021import org.apache.juneau.commons.*; 022 023/** 024 * Utility classes and methods for the {@link Uon @Uon} annotation. 025 * 026 * <h5 class='section'>See Also:</h5><ul> 027 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/UonSupport">UON</a> 028 * </ul> 029 */ 030public class UonAnnotation { 031 032 /** 033 * Prevents instantiation. 034 */ 035 private UonAnnotation() {} 036 037 /** 038 * Builder class. 039 */ 040 public static class Builder extends AnnotationObject.Builder { 041 042 private String[] description = {}; 043 044 /** 045 * Constructor. 046 */ 047 protected Builder() { 048 super(Uon.class); 049 } 050 051 /** 052 * Instantiates a new {@link Uon @Uon} object initialized with this builder. 053 * 054 * @return A new {@link Uon @Uon} object. 055 */ 056 public Uon build() { 057 return new Object(this); 058 } 059 060 /** 061 * Sets the description property. 062 * 063 * @param value The new value. 064 * @return This object. 065 */ 066 public Builder description(String...value) { 067 description = value; 068 return this; 069 } 070 071 } 072 073 @SuppressWarnings({ 074 "java:S2160" // equals() inherited from AnnotationObject compares all annotation interface methods; subclass fields are accessed via those methods 075 }) 076 private static class Object extends AnnotationObject implements Uon { 077 078 private final String[] description; 079 080 Object(UonAnnotation.Builder b) { 081 super(b); 082 this.description = cp(b.description); 083 } 084 085 @Override 086 public String[] description() { 087 return description; 088 } 089 } 090 091 /** Default value */ 092 public static final Uon DEFAULT = create().build(); 093 094 /** 095 * Instantiates a new builder for this class. 096 * 097 * @return A new builder object. 098 */ 099 public static Builder create() { 100 return new Builder(); 101 } 102}