org.vraptor.url.DefaultRequestInfo Maven / Gradle / Ivy
package org.vraptor.url;
/**
* Simple implementation of a request info.
*
* @author Paulo Silveira
* @since 2.2.3
*/
public class DefaultRequestInfo implements RequestInfo {
private final String componentName;
private final String logicName;
private final String viewType;
/**
* @param componentName
* the name of the Component to be used
* @param logicName
* the logic name form the component that will be invoked
*/
public DefaultRequestInfo(String componentName, String logicName) {
this(componentName, logicName, null);
}
/**
* @param componentName
* the name of the Component to be used
* @param logicName
* the logic name form the component that will be invoked
* @param viewType
* "json", "xml" or null for normal treatment
*/
public DefaultRequestInfo(String componentName, String logicName, String viewType) {
this.componentName = componentName;
this.logicName = logicName;
this.viewType = viewType;
}
/* (non-Javadoc)
* @see org.vraptor.url.RequestInfo#getComponentName()
*/
public String getComponentName() {
return componentName;
}
/* (non-Javadoc)
* @see org.vraptor.url.RequestInfo#getLogicName()
*/
public String getLogicName() {
return logicName;
}
/* (non-Javadoc)
* @see org.vraptor.url.RequestInfo#getViewType()
*/
public String getViewType() {
return viewType;
}
/* (non-Javadoc)
* @see org.vraptor.url.RequestInfo#isDefaultView()
*/
public boolean isDefaultView() {
return viewType == null;
}
@Override
public String toString() {
return String.format("[RequestInfo: %s, %s, %s]", componentName, logicName, viewType);
}
}