Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

We discussed several approaches to declare arguments for commands. There are three use cases that must be supported.

  • Interactive shell
  • Bndtools UI
  • Scripts

Metatype interfaces

In this approach the arguments are grouped in interfaces.

@Meta.OCD interface NameAndType {
	enum TYPE { CLASS, INTERFACE };
	@Meta.AD(name="FQN", description="The fully qualified name of the class.") FQN name();
	@Meta.AD(description="The type (class or interface)") TYPE type();
}

@Command()
public void main() {	
	NameAndType nat = m_prompt.ask(NameAndType.class, values);
 
	System.out.println("N: " + nat.name());
	System.out.println("T: " + nat.type());

 

 

 

  • No labels