org.springframework.expression.AccessException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中org.springframework.expression.AccessException.<init>()方法的一些代码示例,展示了AccessException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AccessException.<init>()方法的具体详情如下:
包路径:org.springframework.expression.AccessException
类名称:AccessException
方法名:<init>

AccessException.<init>介绍

[英]Create an AccessException with a specific message.
[中]创建带有特定消息的AccessException。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public Object resolve(EvaluationContext context, String beanName) throws AccessException {
  try {
    return this.beanFactory.getBean(beanName);
  }
  catch (BeansException ex) {
    throw new AccessException("Could not resolve bean reference against BeanFactory", ex);
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public void write(EvaluationContext context, @Nullable Object target, String name, @Nullable Object newValue)
    throws AccessException {
  throw new AccessException("Beans in a BeanFactory are read-only");
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public void write(EvaluationContext context, @Nullable Object target, String name, @Nullable Object newValue)
    throws AccessException {
  throw new AccessException("Beans in a BeanFactory are read-only");
}

代码示例来源:origin: org.springframework/spring-context

@Override
public Object resolve(EvaluationContext context, String beanName) throws AccessException {
  try {
    return this.beanFactory.getBean(beanName);
  }
  catch (BeansException ex) {
    throw new AccessException("Could not resolve bean reference against BeanFactory", ex);
  }
}

代码示例来源:origin: org.springframework/spring-context

@Override
public void write(EvaluationContext context, @Nullable Object target, String name, @Nullable Object newValue)
    throws AccessException {
  throw new AccessException("Beans in a BeanFactory are read-only");
}

代码示例来源:origin: org.springframework/spring-context

@Override
public void write(EvaluationContext context, @Nullable Object target, String name, @Nullable Object newValue)
    throws AccessException {
  throw new AccessException("Beans in a BeanFactory are read-only");
}

代码示例来源:origin: spring-projects/spring-framework

@Nullable
  private Object resolveImplicitVariable(String name) throws AccessException {
    if (this.variableResolver == null) {
      return null;
    }
    try {
      return this.variableResolver.resolveVariable(name);
    }
    catch (Exception ex) {
      throw new AccessException(
          "Unexpected exception occurred accessing '" + name + "' as an implicit variable", ex);
    }
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public TypedValue read(EvaluationContext context, @Nullable Object target, String name) throws AccessException {
  if (this.member instanceof Method) {
    Method method = (Method) this.member;
    try {
      ReflectionUtils.makeAccessible(method);
      Object value = method.invoke(target);
      return new TypedValue(value, this.typeDescriptor.narrow(value));
    }
    catch (Exception ex) {
      throw new AccessException("Unable to access property '" + name + "' through getter method", ex);
    }
  }
  else {
    Field field = (Field) this.member;
    try {
      ReflectionUtils.makeAccessible(field);
      Object value = field.get(target);
      return new TypedValue(value, this.typeDescriptor.narrow(value));
    }
    catch (Exception ex) {
      throw new AccessException("Unable to access field '" + name + "'", ex);
    }
  }
}

代码示例来源:origin: org.springframework/spring-webmvc

@Nullable
  private Object resolveImplicitVariable(String name) throws AccessException {
    if (this.variableResolver == null) {
      return null;
    }
    try {
      return this.variableResolver.resolveVariable(name);
    }
    catch (Exception ex) {
      throw new AccessException(
          "Unexpected exception occurred accessing '" + name + "' as an implicit variable", ex);
    }
  }
}

代码示例来源:origin: spring-projects/spring-framework

throw new AccessException("PropertyAccessor for property '" + name +
      "' on target [" + target + "] does not allow write operations");
    throw new AccessException("Type conversion failure", evaluationException);
      throw new AccessException("Unable to access property '" + name + "' through setter method", ex);
      throw new AccessException("Unable to access field '" + name + "'", ex);
throw new AccessException("Neither setter method nor field found for property '" + name + "'");

代码示例来源:origin: spring-projects/spring-framework

@Override
  public Object resolve(EvaluationContext context, String beanName) throws AccessException {
    if (beanName.equals("foo")) {
      return "custard";
    }
    else if (beanName.equals("foo.bar")) {
      return "trouble";
    }
    else if (beanName.equals("&foo")) {
      return "foo factory";
    }
    else if (beanName.equals("goo")) {
      throw new AccessException("DONT ASK ME ABOUT GOO");
    }
    return null;
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Override
  public Object resolve(EvaluationContext context, String beanName) throws AccessException {
    if (beanName.equals("foo") || beanName.equals("bar")) {
      return new Spr9751_2();
    }
    throw new AccessException("not heard of " + beanName);
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public TypedValue execute(EvaluationContext context, Object... arguments) throws AccessException {
  try {
    ReflectionHelper.convertArguments(
        context.getTypeConverter(), arguments, this.ctor, this.varargsPosition);
    if (this.ctor.isVarArgs()) {
      arguments = ReflectionHelper.setupArgumentsForVarargsInvocation(
          this.ctor.getParameterTypes(), arguments);
    }
    ReflectionUtils.makeAccessible(this.ctor);
    return new TypedValue(this.ctor.newInstance(arguments));
  }
  catch (Exception ex) {
    throw new AccessException("Problem invoking constructor: " + this.ctor, ex);
  }
}

代码示例来源:origin: spring-projects/spring-framework

throw new AccessException("Cannot access length on array class itself");
      throw new AccessException("Unable to access property '" + name + "' through getter method", ex);
      throw new AccessException("Unable to access field '" + name + "'", ex);
throw new AccessException("Neither getter method nor field found for property '" + name + "'");

代码示例来源:origin: spring-projects/spring-framework

@Override
public TypedValue execute(EvaluationContext context, Object target, Object... arguments) throws AccessException {
  try {
    this.argumentConversionOccurred = ReflectionHelper.convertArguments(
        context.getTypeConverter(), arguments, this.originalMethod, this.varargsPosition);
    if (this.originalMethod.isVarArgs()) {
      arguments = ReflectionHelper.setupArgumentsForVarargsInvocation(
          this.originalMethod.getParameterTypes(), arguments);
    }
    ReflectionUtils.makeAccessible(this.methodToInvoke);
    Object value = this.methodToInvoke.invoke(target, arguments);
    return new TypedValue(value, new TypeDescriptor(new MethodParameter(this.originalMethod, -1)).narrow(value));
  }
  catch (Exception ex) {
    throw new AccessException("Problem invoking method: " + this.methodToInvoke, ex);
  }
}

代码示例来源:origin: spring-projects/spring-framework

throw new AccessException("Failed to resolve method", ex);

代码示例来源:origin: spring-projects/spring-framework

@Override
  public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException {
    if (!name.equals("flibbles")) {
      throw new RuntimeException("Assertion Failed! name should be flibbles");
    }
    try {
      flibbles = (Integer) context.getTypeConverter().convertValue(newValue,
          TypeDescriptor.forObject(newValue), TypeDescriptor.valueOf(Integer.class));
    }
    catch (EvaluationException ex) {
      throw new AccessException("Cannot set flibbles to an object of type '" + newValue.getClass() + "'");
    }
  }
}

代码示例来源:origin: org.springframework/spring-expression

@Override
public TypedValue execute(EvaluationContext context, Object... arguments) throws AccessException {
  try {
    ReflectionHelper.convertArguments(
        context.getTypeConverter(), arguments, this.ctor, this.varargsPosition);
    if (this.ctor.isVarArgs()) {
      arguments = ReflectionHelper.setupArgumentsForVarargsInvocation(
          this.ctor.getParameterTypes(), arguments);
    }
    ReflectionUtils.makeAccessible(this.ctor);
    return new TypedValue(this.ctor.newInstance(arguments));
  }
  catch (Exception ex) {
    throw new AccessException("Problem invoking constructor: " + this.ctor, ex);
  }
}

代码示例来源:origin: spring-projects/spring-framework

throw new AccessException("Failed to resolve constructor", ex);

代码示例来源:origin: spring-projects/spring-framework

@Override
public TypedValue execute(EvaluationContext context, Object target, Object... arguments)
    throws AccessException {
  try {
    Method m = HasRoleExecutor.class.getMethod("hasRole", String[].class);
    Object[] args = arguments;
    if (args != null) {
      ReflectionHelper.convertAllArguments(tc, args, m);
    }
    if (m.isVarArgs()) {
      args = ReflectionHelper.setupArgumentsForVarargsInvocation(m.getParameterTypes(), args);
    }
    return new TypedValue(m.invoke(null, args), new TypeDescriptor(new MethodParameter(m,-1)));
  }
  catch (Exception ex) {
    throw new AccessException("Problem invoking hasRole", ex);
  }
}

相关文章

微信公众号

最新文章

更多