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.commons.reflect; 018 019/** 020 * Defines how class names should be formatted when rendered as strings. 021 * 022 * <p> 023 * Controls which parts of the fully qualified class name are included in the output. 024 * 025 * <h5 class='section'>Example:</h5> 026 * <p class='bjava'> 027 * <jc>// Given class: java.util.Map.Entry</jc> 028 * 029 * ClassNameFormat.<jsf>FULL</jsf> <jc>// "java.util.Map$Entry" or "java.util.Map.Entry"</jc> 030 * ClassNameFormat.<jsf>SHORT</jsf> <jc>// "Map$Entry" or "Map.Entry"</jc> 031 * ClassNameFormat.<jsf>SIMPLE</jsf> <jc>// "Entry"</jc> 032 * </p> 033 * 034 * <h5 class='section'>See Also:</h5><ul> 035 * <li class='link'><a class="doclink" href="../../../../../index.html#juneau-commons">Common</a> 036 * </ul> 037 */ 038public enum ClassNameFormat { 039 040 /** 041 * Full name including package and outer classes. 042 * 043 * <h5 class='section'>Examples:</h5> 044 * <ul class='spaced-list'> 045 * <li><js>"java.lang.String"</js> 046 * <li><js>"java.util.Map$Entry"</js> or <js>"java.util.Map.Entry"</js> (depending on separator) 047 * <li><js>"com.example.Outer$Inner$Deep"</js> 048 * </ul> 049 * 050 * <p> 051 * This format includes the complete package path and all enclosing class names. 052 * The separator character between outer and inner classes is configurable. 053 */ 054 FULL, 055 056 /** 057 * Short name including outer classes but not the package. 058 * 059 * <h5 class='section'>Examples:</h5> 060 * <ul class='spaced-list'> 061 * <li><js>"String"</js> 062 * <li><js>"Map$Entry"</js> or <js>"Map.Entry"</js> (depending on separator) 063 * <li><js>"Outer$Inner$Deep"</js> 064 * </ul> 065 * 066 * <p> 067 * This format includes enclosing class names but omits the package. 068 * Useful when the package context is already known or not needed. 069 * The separator character between outer and inner classes is configurable. 070 */ 071 SHORT, 072 073 /** 074 * Simple name without package or outer classes. 075 * 076 * <h5 class='section'>Examples:</h5> 077 * <ul class='spaced-list'> 078 * <li><js>"String"</js> 079 * <li><js>"Entry"</js> 080 * <li><js>"Deep"</js> 081 * </ul> 082 * 083 * <p> 084 * This format returns only the innermost class name, omitting both the package 085 * and any enclosing class names. This is equivalent to {@link Class#getSimpleName()}. 086 */ 087 SIMPLE 088}