code: private void setType(UIComponent component, String type) {
  		Method method;
  		try {
  			method = component.getClass().getMethod("getType");
  			if (null != method) {
  				Object invoke = method.invoke(component);
  				if (invoke != null) {
  					// is it an PrimeFaces component?
  					if (component.getClass().getName().equals("org.primefaces.component.inputtext.InputText")) {
  						if (!"text".equals(invoke)) {
  							// the programmer has explicitly assigned a type
  							return;
  						}
  					}
  					else return;
  				}
  			}
  			
  			method = component.getClass().getMethod("setType", String.class);
  			if (null != method) {
  				method.invoke(component, type);
  				return;
  			}
  		} catch (ReflectiveOperationException e) {
  			// catch block required by compiler, can't happen in reality
  		}
  		if (null == component.getAttributes().get("type") && null == component.getPassThroughAttributes().get("type")) {
  			component.getPassThroughAttributes().put("type", type);
  		}
  	}
docs: Framework-independent approach to setting the type - if possible, by calling the setType() method.
  
  @param component
  @param type