Codota Logo
org.crsh.cli.type
Code IndexAdd Codota to your IDE (free)

How to use org.crsh.cli.type

Best Java code snippets using org.crsh.cli.type (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: crashub/crash

 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;
 }
}
origin: crashub/crash

public CommandFactory(ClassLoader loader) throws NullPointerException {
 this(new ValueTypeFactory(loader));
}
origin: crashub/crash

public Object parse(String s) throws Exception {
 return valueType.parse(effectiveType, s);
}
origin: crashub/crash

public void testBoolean() throws Exception {
 ValueType<Boolean> booleanVT = factory.get(Boolean.class);
 assertEquals(Boolean.class, booleanVT.getType());
 boolean b = booleanVT.parse("false");
 assertEquals(false, b);
}
origin: crashub/crash

 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);
 }
}
origin: crashub/crash

public void testFoo() {
 final URL url = MissingValueTypeTestCase.class.getResource("InvalidValueType");
 assertNotNull(url);
 ClassLoader cl = new ClassLoader(MissingValueTypeTestCase.class.getClassLoader()) {
  @Override
  public Enumeration<URL> getResources(String name) throws IOException {
   if (name.equals("META-INF/services/" + ValueType.class.getName())) {
    return Collections.enumeration(Collections.singleton(url));
   } else {
    return super.getResources(name);
   }
  }
 };
 ValueTypeFactory factory = new ValueTypeFactory(cl);
 ValueType<Custom> custom = factory.get(Custom.class);
 assertNotNull(custom);
}
origin: crashub/crash

} else {
 effectiveType = declaredType;
 valueType = factory.get(declaredType);
 if (valueType == null) {
  throw new IllegalValueTypeException("Type " + declaredType.getName() + " is not handled at the moment");
origin: crashub/crash

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;
}
origin: crashub/crash

public void testString() throws Exception {
 ValueType<String> stringVT = factory.get(String.class);
 assertEquals(String.class, stringVT.getType());
 String s = stringVT.parse("abc");
 assertEquals("abc", s);
}
origin: crashub/crash

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);
}
origin: crashub/crash

public final V parse(String s) throws Exception {
 return parse(type, s);
}
origin: org.crashub/crash.cli

public CommandFactory(ClassLoader loader) throws NullPointerException {
 this(new ValueTypeFactory(loader));
}
origin: org.crashub/crash.cli

 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;
 }
}
origin: crashub/crash

public void testEnum() throws Exception {
 ValueType<Enum> stringVT = factory.<Enum, Color>get(Color.class);
 assertEquals(Enum.class, stringVT.getType());
 Color red = stringVT.parse(Color.class, "RED");
 assertEquals(Color.RED, red);
}
origin: crashub/crash

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"));
}
origin: org.crashub/crash.cli

public final V parse(String s) throws Exception {
 return parse(type, s);
}
origin: org.crsh/crsh.cli

public CommandFactory(ClassLoader loader) throws NullPointerException {
 this(new ValueTypeFactory(loader));
}
origin: org.crsh/crsh.cli

 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;
 }
}
origin: crashub/crash

public void testInteger() throws Exception {
 ValueType<Integer> stringVT = factory.get(Integer.class);
 assertEquals(Integer.class, stringVT.getType());
 int i = stringVT.parse("123");
 assertEquals(123, i);
}
origin: org.crsh/crsh.cli

public Object parse(String s) throws Exception {
 return valueType.parse(effectiveType, s);
}
org.crsh.cli.type

Most used classes

  • ValueType
    Defines a type for values, this is used for transforming a textual value into a type, for command ar
  • ValueTypeFactory
    A factory for value types.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now