/* * Copyright 2004 Niall Pemberton * * Licensed 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. */ package lib.framework.util; import org.apache.commons.beanutils.LazyDynaBean; /** *
Custom LazyDynaBean which uses an array of itself as the default * indexed property.
* *Having an array of itself as the default indexed property means * this bean can nest automatically add infinitum.
* *Additionally I removed some of the automatic property instantiation * which I found too aggressive, by overriding the createOtherProperty() * method.
* * @author Niall Pemberton */ public class NestedLazyBean extends LazyDynaBean { /** * Default Constructor. */ public NestedLazyBean() { super(); } /** * Implements aNestedLazyBean[] as the default indexed
* property implementation.
*
* @return a new empty NestedLazyBean[0] array.
*/
protected Object defaultIndexedProperty(String name) {
return new NestedLazyBean[0];
}
/**
* Returns Null removing some of the automatic object
* instantiation that I found too aggressive.
*
* @return Null
*/
protected Object createOtherProperty(String name, Class type) {
return null;
}
}