001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.annotation; 014 015import java.lang.annotation.*; 016import java.lang.reflect.*; 017 018import org.apache.juneau.*; 019import org.apache.juneau.reflect.*; 020 021/** 022 * A concrete implementation of the {@link Beanc} annotation. 023 * 024 * <ul class='seealso'> 025 * <li class='jm'>{@link BeanContextBuilder#annotations(Annotation...)} 026 * </ul> 027 */ 028public class BeancAnnotation implements Beanc { 029 030 private String on="", properties=""; 031 032 /** 033 * Constructor. 034 * 035 * @param on The initial value for the <c>on</c> property. 036 * <br>See {@link Beanc#on()} 037 */ 038 public BeancAnnotation(String on) { 039 on(on); 040 } 041 042 /** 043 * Constructor. 044 * 045 * @param on The initial value for the <c>on</c> property. 046 * <br>See {@link Beanc#on()} 047 */ 048 public BeancAnnotation(Constructor<?> on) { 049 on(on); 050 } 051 052 @Override 053 public Class<? extends Annotation> annotationType() { 054 return Beanc.class; 055 } 056 057 @Override 058 public String on() { 059 return on; 060 } 061 062 /** 063 * Sets the <c>on</c> property on this annotation. 064 * 065 * @param value The new value for this property. 066 * @return This object (for method chaining). 067 */ 068 public BeancAnnotation on(String value) { 069 this.on = value; 070 return this; 071 } 072 073 /** 074 * Sets the <c>on</c> property on this annotation. 075 * 076 * @param value The new value for this property. 077 * @return This object (for method chaining). 078 */ 079 public BeancAnnotation on(Constructor<?> value) { 080 this.on = ConstructorInfo.of(value).getFullName(); 081 return this; 082 } 083 084 @Override 085 public String properties() { 086 return properties; 087 } 088 089 /** 090 * Sets the <c>properties</c> property on this annotation. 091 * 092 * @param value The new value for this property. 093 * @return This object (for method chaining). 094 */ 095 public BeancAnnotation properties(String value) { 096 this.properties = value; 097 return this; 098 } 099}