Java Code Examples for org.springframework.expression.TypedValue#NULL

The following examples show how to use org.springframework.expression.TypedValue#NULL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FunctionReference.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Override
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException {
	TypedValue value = state.lookupVariable(this.name);
	if (value == TypedValue.NULL) {
		throw new SpelEvaluationException(getStartPosition(), SpelMessage.FUNCTION_NOT_DEFINED, this.name);
	}
	if (!(value.getValue() instanceof Method)) {
		// Possibly a static Java method registered as a function
		throw new SpelEvaluationException(
				SpelMessage.FUNCTION_REFERENCE_CANNOT_BE_INVOKED, this.name, value.getClass());
	}

	try {
		return executeFunctionJLRMethod(state, (Method) value.getValue());
	}
	catch (SpelEvaluationException ex) {
		ex.setPosition(getStartPosition());
		throw ex;
	}
}
 
Example 2
Source File: SpelExpression.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private TypedValue toTypedValue(Object object) {
	if (object == null) {
		return TypedValue.NULL;
	}
	else {
		return new TypedValue(object);
	}
}
 
Example 3
Source File: SimpleEvaluationContext.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private SimpleEvaluationContext(List<PropertyAccessor> accessors, List<MethodResolver> resolvers,
		@Nullable TypeConverter converter, @Nullable TypedValue rootObject) {

	this.propertyAccessors = accessors;
	this.methodResolvers = resolvers;
	this.typeConverter = (converter != null ? converter : new StandardTypeConverter());
	this.rootObject = (rootObject != null ? rootObject : TypedValue.NULL);
}
 
Example 4
Source File: CrateDocumentPropertyAccessor.java    From spring-data-crate with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public TypedValue read(EvaluationContext context, Object target, String name) {
	Map<String, Object> source = (Map<String, Object>) target;
	Object value = source.get(name);
	return value == null ? TypedValue.NULL : new TypedValue(value);
}
 
Example 5
Source File: MapPropertyAccessor.java    From kork with Apache License 2.0 5 votes vote down vote up
@Override
public TypedValue read(final EvaluationContext context, final Object target, final String name)
    throws AccessException {
  try {
    return super.read(context, target, name);
  } catch (AccessException ae) {
    if (allowUnknownKeys) {
      return TypedValue.NULL;
    }
    throw ae;
  }
}
 
Example 6
Source File: SimpleEvaluationContext.java    From java-technology-stack with MIT License 5 votes vote down vote up
private SimpleEvaluationContext(List<PropertyAccessor> accessors, List<MethodResolver> resolvers,
		@Nullable TypeConverter converter, @Nullable TypedValue rootObject) {

	this.propertyAccessors = accessors;
	this.methodResolvers = resolvers;
	this.typeConverter = (converter != null ? converter : new StandardTypeConverter());
	this.rootObject = (rootObject != null ? rootObject : TypedValue.NULL);
}
 
Example 7
Source File: SpelExpression.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private TypedValue toTypedValue(Object object) {
	return (object != null ? new TypedValue(object) : TypedValue.NULL);
}
 
Example 8
Source File: ValueRef.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public TypedValue getValue() {
	return TypedValue.NULL;
}
 
Example 9
Source File: NullLiteral.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public TypedValue getLiteralValue() {
	return TypedValue.NULL;
}
 
Example 10
Source File: StandardEvaluationContext.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
public void setRootObject(Object rootObject) {
	this.rootObject = (rootObject != null ? new TypedValue(rootObject) : TypedValue.NULL);
}
 
Example 11
Source File: StandardEvaluationContext.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public void setRootObject(Object rootObject) {
	this.rootObject = (rootObject != null ? new TypedValue(rootObject) : TypedValue.NULL);
}
 
Example 12
Source File: ExpressionState.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public TypedValue lookupVariable(String name) {
	Object value = this.relatedContext.lookupVariable(name);
	return (value != null ? new TypedValue(value) : TypedValue.NULL);
}
 
Example 13
Source File: NullLiteral.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public TypedValue getLiteralValue() {
	return TypedValue.NULL;
}
 
Example 14
Source File: ValueRef.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public TypedValue getValue() {
	return TypedValue.NULL;
}
 
Example 15
Source File: NullLiteral.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public TypedValue getLiteralValue() {
	return TypedValue.NULL;
}
 
Example 16
Source File: ValueRef.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public TypedValue getValue() {
	return TypedValue.NULL;
}
 
Example 17
Source File: ExpressionState.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public TypedValue lookupVariable(String name) {
	Object value = this.relatedContext.lookupVariable(name);
	return (value != null ? new TypedValue(value) : TypedValue.NULL);
}
 
Example 18
Source File: StandardEvaluationContext.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Create a {@code StandardEvaluationContext} with a null root object.
 */
public StandardEvaluationContext() {
	this.rootObject = TypedValue.NULL;
}
 
Example 19
Source File: SpelExpression.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private TypedValue toTypedValue(@Nullable Object object) {
	return (object != null ? new TypedValue(object) : TypedValue.NULL);
}
 
Example 20
Source File: ValueRef.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public TypedValue getValue() {
	return TypedValue.NULL;
}