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.rest.labels; 014 015import org.apache.juneau.*; 016import org.apache.juneau.annotation.*; 017 018/** 019 * @deprecated Use {@link org.apache.juneau.rest.helper.BeanDescription} 020 */ 021@Deprecated 022@Bean(properties="type,properties") 023public final class BeanDescription { 024 025 /** The bean class type. */ 026 public String type; 027 028 /** The bean properties. */ 029 public BeanPropertyDescription[] properties; 030 031 /** 032 * Constructor 033 * 034 * @param c The bean class type. 035 */ 036 public BeanDescription(Class<?> c) { 037 type = c.getName(); 038 BeanMeta<?> bm = BeanContext.DEFAULT.getBeanMeta(c); 039 if (bm == null) 040 throw new FormattedRuntimeException("Class ''{0}'' is not a valid bean.", c); 041 properties = new BeanPropertyDescription[bm.getPropertyMetas().size()]; 042 int i = 0; 043 for (BeanPropertyMeta pm : bm.getPropertyMetas()) 044 properties[i++] = new BeanPropertyDescription(pm.getName(), pm.getClassMeta()); 045 } 046 047 /** 048 * Information about a bean property. 049 */ 050 public static class BeanPropertyDescription { 051 052 /** The bean property name. */ 053 public String name; 054 055 /** The bean property filtered class type. */ 056 public String type; 057 058 /** 059 * Constructor. 060 * 061 * @param name The bean property name. 062 * @param type The bean property class type. 063 */ 064 public BeanPropertyDescription(String name, ClassMeta<?> type) { 065 this.name = name; 066 this.type = type.getSerializedClassMeta(null).toString(); 067 } 068 } 069}