當前位置: 首頁>>代碼示例>>Java>>正文


Java ValueExpression.getType方法代碼示例

本文整理匯總了Java中javax.el.ValueExpression.getType方法的典型用法代碼示例。如果您正苦於以下問題:Java ValueExpression.getType方法的具體用法?Java ValueExpression.getType怎麽用?Java ValueExpression.getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.el.ValueExpression的用法示例。


在下文中一共展示了ValueExpression.getType方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getValue

import javax.el.ValueExpression; //導入方法依賴的package包/類
public Object getValue(UIXRenderingContext context)
{
  FacesBean bean = _component.getFacesBean();
  // Try to get an explicit Converter
  Converter converter = (Converter)
    bean.getProperty(UIXValue.CONVERTER_KEY);

  // OK, no explicit converter, look at the ValueExpression
  if (converter == null)
  {
    ValueExpression expression = bean.getValueExpression(UIXValue.VALUE_KEY);
    if (expression != null)
    {
      FacesContext fContext = (context == null) ? 
        FacesContext.getCurrentInstance() : context.getFacesContext();
      Class<?> type = expression.getType(fContext.getELContext());
      converter = ConverterUtils.createConverter(fContext, type);
    }
  }
  
  return converter;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:23,代碼來源:ConverterBoundValue.java

示例2: getType

import javax.el.ValueExpression; //導入方法依賴的package包/類
@Override
public Class<?> getType(EvaluationContext ctx) throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            return expr.getType(ctx.getELContext());
        }
    }
    ctx.setPropertyResolved(false);
    Class<?> result = ctx.getELResolver().getType(ctx, null, this.image);
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled.null", this.image));
    }
    return result;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:18,代碼來源:AstIdentifier.java

示例3: getDefaultConverter

import javax.el.ValueExpression; //導入方法依賴的package包/類
/**
 * Override to return a Converter for the items in the value,
 * not the value itself.
 */
@Override
protected Converter getDefaultConverter(
  FacesContext context,
  UIComponent  copmonent,
  FacesBean    bean)
{
  ValueExpression expression = getValueExpression(copmonent, bean);
  if (expression == null)
    return null;

  Class<?> type = expression.getType(context.getELContext());
  if ((type == null) || type.isAssignableFrom(List.class))
    return null;

  if (type.isArray())
  {
    Class<?> itemClass = type.getComponentType();
    return ConverterUtils.createConverter(context, itemClass);
  }

  _throwUnsupportedModelType(context, type, null);
  return null;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:28,代碼來源:SimpleSelectManyRenderer.java

示例4: getType

import javax.el.ValueExpression; //導入方法依賴的package包/類
@Override
public Class<?> getType(EvaluationContext ctx) throws ELException {
	VariableMapper varMapper = ctx.getVariableMapper();
	if (varMapper != null) {
		ValueExpression expr = varMapper.resolveVariable(this.image);
		if (expr != null) {
			return expr.getType(ctx.getELContext());
		}
	}
	ctx.setPropertyResolved(false);
	Class<?> result = ctx.getELResolver().getType(ctx, null, this.image);
	if (!ctx.isPropertyResolved()) {
		throw new PropertyNotFoundException(MessageFactory.get("error.resolver.unhandled.null", this.image));
	}
	return result;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:17,代碼來源:AstIdentifier.java

示例5: getDefaultConverter

import javax.el.ValueExpression; //導入方法依賴的package包/類
protected Converter getDefaultConverter(
  FacesContext context,
  UIComponent  component,
  FacesBean    bean)
{
  ValueExpression expression = getValueExpression(component, bean);
  if (expression == null)
    return null;

  Class<?> type = expression.getType(context.getELContext());
  return ConverterUtils.createConverter(context, type);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:13,代碼來源:ValueRenderer.java

示例6: _getConverterWithType

import javax.el.ValueExpression; //導入方法依賴的package包/類
private Converter _getConverterWithType(FacesContext context)
{
  Converter converter = getConverter();
  if (converter != null)
  {
    return converter;
  }

  ValueExpression valueExpression = getValueExpression("value");
  if (valueExpression == null)
  {
    return null;
  }

  Class<?> converterType = valueExpression.getType(context.getELContext());
  // if converterType is null, String, or Object, assume
  // no conversion is needed
  if (converterType == null ||
      converterType == String.class ||
      converterType == Object.class)
  {
    return null;
  }

  // if getType returns a type for which we support a default
  // conversion, acquire an appropriate converter instance.
  try
  {
    Application application = context.getApplication();
    return application.createConverter(converterType);
  }
  catch (Exception e)
  {
    return null;
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:37,代碼來源:UIXEditableValueTemplate.java

示例7: getType

import javax.el.ValueExpression; //導入方法依賴的package包/類
public Class getType(EvaluationContext ctx) throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            return expr.getType(ctx.getELContext());
        }
    }
    ctx.setPropertyResolved(false);
    return ctx.getELResolver().getType(ctx, null, this.image);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:AstIdentifier.java

示例8: getConverter

import javax.el.ValueExpression; //導入方法依賴的package包/類
private Converter getConverter(FacesContext context, UIComponent component) {
	Converter converter = ((UIInput) component).getConverter();
	if (converter != null) {
		return converter;
	}
	ValueExpression exp = component.getValueExpression("value");
	if (exp == null) {
		return null;
	}
	Class valueType = exp.getType(context.getELContext());
	if (valueType == null) {
		return null;
	}
	return context.getApplication().createConverter(valueType);
}
 
開發者ID:phoenixctms,項目名稱:ctsms,代碼行數:16,代碼來源:SketchPadRenderer.java

示例9: getConverter

import javax.el.ValueExpression; //導入方法依賴的package包/類
static public Converter getConverter(
  UIComponent component)
{  
  FacesContext fContext = FacesContext.getCurrentInstance();

  Converter converter = null;
  Class<?> modelClass = null;
  
  ValueExpression expression = component.getValueExpression("value");
  if (expression != null)
  {
    modelClass = expression.getType(fContext.getELContext());
    if (modelClass == null)
    {
      Object o = expression.getValue(fContext.getELContext());
      if (o != null)
      {
        modelClass = o.getClass();
      }
    }
  }

  if ((modelClass != null) && 
      ( modelClass.isArray() ||  modelClass.isAssignableFrom(List.class)))
  {
      // get the itemClass in the case where modelClass is an array or List
      // for instance, in the case of selectManyListbox
      Class<?> itemClass = modelClass.getComponentType();
      if (itemClass != null)
      {
         converter = ConverterUtils.createConverter(fContext, itemClass);           
      }      
  }
  else
  {
    converter = ConverterUtils.createConverter(fContext, modelClass);
  }


  return converter;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:42,代碼來源:SelectItemSupport.java

示例10: getConvertedValue

import javax.el.ValueExpression; //導入方法依賴的package包/類
/**
 * Support the following types of values:
 * Object[] (that contains strings),
 *   String[], List (that contains strings). (selected values)
 * @todo This throws a ConverterException on the first unconvertable
 *  value;  it should wait
 */
@Override
public Object getConvertedValue(
  FacesContext context,
  UIComponent  component,
  Object       submittedValue
  ) throws ConverterException
{
  // If "submittedValue" is null, something's gone wrong;  that
  // should be caught by editable component
  assert(submittedValue != null);

  String[] values = (String[]) submittedValue;
  if (values.length == 0)
    return null;

  FacesBean bean = getFacesBean(component);
  Converter converter = getConverter(component, bean);
  if ( converter == null)
    converter = getDefaultConverter(context, component, bean);

  Class<?> modelClass = null;
  ValueExpression expression = getValueExpression(component, bean);
  if (expression != null)
  {
    modelClass = expression.getType(context.getELContext());
  }

  boolean valuePassThru = getValuePassThru(component, bean);
  if (!valuePassThru)
  {
    return _convertIndexedSubmittedValue(context,
                                         component,
                                         converter,
                                         values,
                                         modelClass);

  }
  else
  {
    return _convertSubmittedValue(context,
                                  component,
                                  converter,
                                  values,
                                  modelClass);
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:54,代碼來源:SimpleSelectManyRenderer.java


注:本文中的javax.el.ValueExpression.getType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。