All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jvnet.annox.parser.value.XCharAnnotationValueParser Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
package org.jvnet.annox.parser.value;

import org.jvnet.annox.model.annotation.value.XAnnotationValue;
import org.jvnet.annox.model.annotation.value.XCharAnnotationValue;
import org.jvnet.annox.parser.exception.ValueParseException;
import org.jvnet.annox.parser.java.visitor.CharacterExpressionVisitor;
import org.jvnet.annox.parser.java.visitor.ExpressionVisitor;

public class XCharAnnotationValueParser extends
		XAnnotationValueParser {

	@Override
	public XAnnotationValue parse(String value, Class type)
			throws ValueParseException {
		if (value.length() != 1) {
			throw new ValueParseException(value, type);
		}
		return construct(Character.valueOf(value.charAt(0)), type);
	}

	@Override
	public XAnnotationValue construct(Character value, Class type) {
		return new XCharAnnotationValue(value);
	}

	@Override
	public ExpressionVisitor> createExpressionVisitor(
			Class type) {
		return new CharacterExpressionVisitor(type);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy