Java tutorial
/* *Copyright 2016 Dominik Szalai (emptulik@gmail.com) * *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. */ /* * Copyright 2016 Dominik Szalai (emptulik@gmail.com) * * 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 cz.muni.fi.editor.webapp.forms.factories; import cz.muni.fi.editor.webapp.forms.OrganizationForm; import cz.muni.fi.editor.webapp.forms.UserFormProfile; import org.apache.commons.collections4.FactoryUtils; import org.apache.commons.collections4.list.LazyList; import org.springframework.beans.factory.FactoryBean; import org.springframework.stereotype.Component; import java.util.ArrayList; /** * Created by Dominik Szalai - emptulik at gmail.com on 19.8.2016. */ @Component public class UserFormProfileFactory implements FactoryBean<UserFormProfile> { @Override public UserFormProfile getObject() throws Exception { UserFormProfile uf = new UserFormProfile(); uf.setActive(Boolean.TRUE); uf.setOrganizations( LazyList.lazyList(new ArrayList<>(), FactoryUtils.instantiateFactory(OrganizationForm.class))); return uf; } @Override public Class<?> getObjectType() { return UserFormProfile.class; } @Override public boolean isSingleton() { return false; } }