blob: 14a6a6c8e0021d033b03ce1da00d094311c39b3b [file] [log] [blame]
<!--
/***************************************************************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
***************************************************************************************************************************/
-->
Stop Classes
<p>
Whereas interface filters limit properties defined on child classes, stop filters
do the opposite and limit properties defined on parent classes.
</p>
<p>
Stop classes are defined through the following:
</p>
<ul class='javatree'>
<li class='ja'>{@link oaj.annotation.Bean#stopClass() Bean(stopClass)}
<li class='jf'>{@link oaj.transform.BeanFilterBuilder#stopClass(Class)}
</ul>
<p>
Stop classes are identical in purpose to the stop class specified by {@link java.beans.Introspector#getBeanInfo(Class, Class)}.
Any properties in the stop class or in its base classes will be ignored during serialization.
</p>
<p>
For example, in the following class hierarchy, instances of <c>C3</c> will include property <c>p3</c>,
but not <c>p1</c> or <c>p2</c>.
</p>
<p class='bpcode w800'>
<jk>public class</jk> C1 {
<jk>public int</jk> getP1();
}
<jk>public class</jk> C2 <jk>extends</jk> C1 {
<jk>public int</jk> getP2();
}
<ja>@Bean</ja>(stopClass=C2.<jk>class</jk>)
<jk>public class</jk> C3 <jk>extends</jk> C2 {
<jk>public int</jk> getP3();
}
<jc>// Serializes property 'p3', but NOT 'p1' or 'p2'.</jc>
String json = JsonSerializer.<jsf>DEFAULT</jsf>.serialize(<jk>new</jk> C3());
</p>