Example usage for org.springframework.expression AccessException AccessException

List of usage examples for org.springframework.expression AccessException AccessException

Introduction

In this page you can find the example usage for org.springframework.expression AccessException AccessException.

Prototype

public AccessException(String message) 

Source Link

Document

Create an AccessException with a specific message.

Usage

From source file:net.abhinavsarkar.spelhelper.ReadOnlyGenericPropertyAccessor.java

@Override
public final void write(final EvaluationContext context, final Object target, final String name,
        final Object newValue) throws AccessException {
    throw new AccessException(MessageFormat.format("Cannot write property: {0} of target: {1}", name, target));
}

From source file:org.echocat.redprecursor.annotations.utils.MethodCallPropertyAccessor.java

@Override
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
    final Object value;
    if (target instanceof MethodCall) {
        final MethodCall<?> methodCall = (MethodCall<?>) target;
        if (THIS_KEYWORD.equals(name)) {
            final Object thisInstance = methodCall.getThis();
            value = thisInstance != null ? thisInstance : methodCall.getType();
        } else {/*from  ww  w .  jav a2  s .  co m*/
            value = methodCall.getParameters().getParameter(name).getValue();
        }
    } else {
        throw new AccessException(target + " is no instance of " + MethodCall.class.getName() + ".");
    }
    return new TypedValue(value);
}

From source file:org.echocat.redprecursor.annotations.utils.MethodCallPropertyAccessor.java

@Override
public void write(EvaluationContext context, Object target, String name, Object newValue)
        throws AccessException {
    throw new AccessException("Could not modify an instance of " + MethodCall.class.getName());
}

From source file:net.abhinavsarkar.spelhelper.ImplicitPropertyAccessor.java

@Override
public TypedValue read(final EvaluationContext context, final Object target, final String name)
        throws AccessException {
    if (canRead(context, target, name)) {
        String cacheKey = target.getClass().getName() + "." + name;
        return CACHE.get(cacheKey).execute(context, target, new Object[0]);
    }//w ww. j a  v  a2s.  c  om
    throw new AccessException(MessageFormat.format("Cannot read property: {0} of target: {1}", name, target));
}