public Object parse(String s) throws Exception { return valueType.parse(effectiveType, s); }
public ParameterDescriptor( ParameterType<?> type, Description description, boolean required, boolean password, boolean unquote, Class<? extends Completer> completerType, Annotation annotation) throws IllegalValueTypeException, IllegalParameterException { // if (completerType == EmptyCompleter.class) { completerType = type.getValueType().getCompleter(); } // this.description = description; this.required = required; this.password = password; this.completerType = completerType; this.annotation = annotation; this.unquote = unquote; this.type = type; }
public <T, S extends T> ValueType<T> get(Class<S> clazz) { ValueType<?> bestType = null; int bestDegree = Integer.MAX_VALUE; for (ValueType<?> type : types) { int degree = type.getDistance(clazz); if (degree != -1 && degree < bestDegree) { bestType = type; bestDegree = degree; } } return (ValueType<T>)bestType; } }
public final V parse(String s) throws Exception { return parse(type, s); }
public <T, S extends T> ValueType<T> get(Class<S> clazz) { ValueType<?> bestType = null; int bestDegree = Integer.MAX_VALUE; for (ValueType<?> type : types) { int degree = type.getDistance(clazz); if (degree != -1 && degree < bestDegree) { bestType = type; bestDegree = degree; } } return (ValueType<T>)bestType; } }
public ParameterDescriptor( ParameterType<?> type, Description description, boolean required, boolean password, boolean unquote, Class<? extends Completer> completerType, Annotation annotation) throws IllegalValueTypeException, IllegalParameterException { // if (completerType == EmptyCompleter.class) { completerType = type.getValueType().getCompleter(); } // this.description = description; this.required = required; this.password = password; this.completerType = completerType; this.annotation = annotation; this.unquote = unquote; this.type = type; }
public void testObjectName() throws Exception { ValueType<ObjectName> propertiesVT = factory.get(ObjectName.class); ObjectName name = propertiesVT.parse(ObjectName.class, "foo:bar=juu"); assertEquals(new ObjectName("foo", "bar", "juu"), name); } }
public <T, S extends T> ValueType<T> get(Class<S> clazz) { ValueType<?> bestType = null; int bestDegree = Integer.MAX_VALUE; for (ValueType<?> type : types) { int degree = type.getDistance(clazz); if (degree != -1 && degree < bestDegree) { bestType = type; bestDegree = degree; } } return (ValueType<T>)bestType; } }
public ParameterDescriptor( Object binding, ParameterType<?> type, Description description, boolean required, boolean password, boolean unquote, Class<? extends Completer> completerType, Annotation annotation) throws IllegalValueTypeException, IllegalParameterException { // if (completerType == EmptyCompleter.class) { completerType = type.getValueType().getCompleter(); } // this.binding = binding; this.description = description; this.required = required; this.password = password; this.completerType = completerType; this.annotation = annotation; this.unquote = unquote; this.type = type; }
public void testFile() throws Exception { ValueType<File> fileVT = factory.get(File.class); File tmp = File.createTempFile("foo", ".bar"); tmp.deleteOnExit(); File f = fileVT.parse(tmp.getAbsolutePath()); assertNotNull(f); assertEquals(f, tmp); }
public void testProperties() throws Exception { ValueType<Properties> propertiesVT = factory.get(Properties.class); Properties props = propertiesVT.parse("org.apache.jackrabbit.repository.conf=repository" + "-in-memory.xml;org.apache.jackrabbit.repository.home=/home/ehugonnet/tmp/crash/jcr/target" + "/test-classes/conf/transient"); assertNotNull(props); assertEquals(2, props.size()); assertEquals("repository-in-memory.xml", props.get("org.apache.jackrabbit.repository.conf")); assertEquals("/home/ehugonnet/tmp/crash/jcr/target/test-classes/conf/transient", props.get("org.apache.jackrabbit.repository.home")); }
public final V parse(String s) throws Exception { return parse(type, s); }
public Object parse(String s) throws Exception { return valueType.parse(effectiveType, s); }
public Object parse(String s) throws Exception { return valueType.parse(effectiveType, s); }
public abstract <S extends V> S parse(Class<S> type, String s) throws Exception;