org.seedstack.seed.shell.commands.GetCommand Maven / Gradle / Ivy
The newest version!
/**
* Copyright (c) 2013-2015 by The SeedStack authors. All rights reserved.
*
* This file is part of SeedStack, An enterprise-oriented full development stack.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.seed.shell.commands;
import org.seedstack.seed.core.spi.command.Argument;
import org.seedstack.seed.core.spi.command.CommandDefinition;
import org.seedstack.seed.core.spi.command.Command;
import org.apache.commons.beanutils.BeanUtils;
import java.lang.reflect.InvocationTargetException;
/**
* This command return the property value of input bean.
*
* @author [email protected]
*/
@CommandDefinition(scope = "", name = "get", description = "Get a property on input object")
public class GetCommand implements Command {
@Argument(index = 0, description = "The property to get")
private String property;
@Override
public Object execute(Object object) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
if (object == null) {
return null;
}
return BeanUtils.getProperty(object, property);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy