@Test public void testAnArgDescriptorThatTakesAList() { final ArgDescriptor listArgDesc = new ArgDescriptor(ArgType.STRINGS, "strings", "A list of strings."); assertTrue("isCompatibleList() is broken.", listArgDesc.isCompatibleList(String.class)); assertFalse("isCompatibleList() is broken.", listArgDesc.isCompatibleList(Object.class)); }
public boolean isCompatibleList(final Class listElementType) { if (listElementType != null) { for (final Class compatibleType : argType.getCompatibleTypes()) { if (compatibleType == listElementType) return true; } return false; } for (final Class compatibleType : argType.getCompatibleTypes()) { if (FunctionUtil.isTypeOfList(compatibleType)) return true; } return false; }
ArgDescriptor { public boolean isCompatibleList(final Class listElementType) { if (listElementType != null) { for (final Class compatibleType : argType.getCompatibleTypes()) { if (compatibleType == listElementType) return true; } return false; } for (final Class compatibleType : argType.getCompatibleTypes()) { if (FunctionUtil.isTypeOfList(compatibleType)) return true; } return false; } }
ArgDescriptor { public boolean isCompatibleList(final Class listElementType) { if (listElementType != null) { for (final Class compatibleType : argType.getCompatibleTypes()) { if (compatibleType == listElementType) return true; } return false; } for (final Class compatibleType : argType.getCompatibleTypes()) { if (FunctionUtil.isTypeOfList(compatibleType)) return true; } return false; } ArgDescriptor(final ArgType argType, final String argName, final String description); }
ArgDescriptor { public boolean isCompatibleList(final Class listElementType) { if (listElementType != null) { for (final Class compatibleType : argType.getCompatibleTypes()) { if (compatibleType == listElementType) return true; } return false; } for (final Class compatibleType : argType.getCompatibleTypes()) { if (FunctionUtil.isTypeOfList(compatibleType)) return true; } return false; } ArgDescriptor(final ArgType argType, final String argName, final String description); ArgType getArgType(); String getArgName(); String getDescription(); boolean isOptional(); boolean isCompatibleWith(final Class type); boolean isCompatibleList(final Class listElementType); Class[] getCompatibleTypes(); boolean acceptsMultipleArgs(); }
ArgDescriptor { public boolean isCompatibleList(final Class listElementType) { if (listElementType != null) { for (final Class compatibleType : argType.getCompatibleTypes()) { if (compatibleType == listElementType) return true; } return false; } for (final Class compatibleType : argType.getCompatibleTypes()) { if (FunctionUtil.isTypeOfList(compatibleType)) return true; } return false; } ArgDescriptor(final ArgType argType, final String argName, final String description); ArgType getArgType(); String getArgName(); String getDescription(); boolean isOptional(); boolean isCompatibleWith(final Class type); boolean isCompatibleList(final Class listElementType); Class[] getCompatibleTypes(); boolean acceptsMultipleArgs();  }