public SrcClass superClass( Class superClass ) { _superClass = new SrcType( superClass ); return this; }
public SrcClass superClass( String superClass ) { _superClass = new SrcType( superClass ); return this; }
public T returns( Class returns ) { _returns = new SrcType( returns ); return (T)this; }
public SrcParameter type( String type ) { _type = new SrcType( type ); return this; }
public SrcField type( Class type ) { _type = new SrcType( type ); return this; }
public SrcParameter type( Class type ) { _type = new SrcType( type ); return this; }
public T returns( String returns ) { _returns = new SrcType( returns ); return (T)this; }
public SrcField type( String type ) { _type = new SrcType( type ); return this; }
public SrcType addTypeParam( Class type ) { SrcType srcType = new SrcType( type ); _typeParams.add( srcType ); return this; }
public SrcType addTypeParam( String type ) { SrcType srcType = new SrcType( type ); _typeParams.add( srcType ); return this; }
public SrcClass addInterface( Class iface ) { SrcType t = new SrcType( iface ); return addInterface( t ); }
private SrcExpression getFile() { try { return new SrcRawExpression( new SrcType( "String" ), _file.toURI().toURL().toString() ); } catch( MalformedURLException e ) { throw new RuntimeException( e ); } }
private SrcExpression getFile() { try { return new SrcRawExpression( new SrcType( "String" ), _file.toURI().toURL().toString() ); } catch( MalformedURLException e ) { throw new RuntimeException( e ); } }
public SrcClass addInterface( String iface ) { SrcType t = new SrcType( iface ); return addInterface( t ); }
private SrcSwitchStatement makeGetValueBynameSwitch( FqnCacheNode<String> node ) { SrcSwitchStatement stmt = new SrcSwitchStatement(); stmt.expr( new SrcIdentifier( "propertyName" ) ); for( FqnCacheNode<String> childNode : node.getChildren() ) { stmt.addCase( new SrcSwitchCase( new SrcType( "String" ), childNode.getName() ) .statement( new SrcReturnStatement( String.class, childNode.getUserData() ) ) ); } return stmt; }
private SrcSwitchStatement makeGetValueBynameSwitch( FqnCacheNode<String> node ) { SrcSwitchStatement stmt = new SrcSwitchStatement(); stmt.expr( new SrcIdentifier( "propertyName" ) ); for( FqnCacheNode<String> childNode : node.getChildren() ) { stmt.addCase( new SrcSwitchCase( new SrcType( "String" ), childNode.getName() ) .statement( new SrcReturnStatement( String.class, childNode.getUserData() ) ) ); } return stmt; }
private SrcAnnotationExpression addSourcePositionAnnotation( FqnCacheNode<String> node ) { return new SrcAnnotationExpression( SourcePosition.class.getSimpleName() ) .addArgument( new SrcArgument( new SrcMemberAccessExpression( _fqn, FIELD_FILE_URL ) ).name( "url" ) ) .addArgument( "feature", new SrcType( "String" ), node.getName() ) .addArgument( "offset", int.class, findOffsetOf( node ) ) .addArgument( "length", int.class, node.getName() == null ? 0 : node.getName().length() ); }
private SrcAnnotationExpression addSourcePositionAnnotation( FqnCacheNode<String> node ) { return new SrcAnnotationExpression( SourcePosition.class.getSimpleName() ) .addArgument( new SrcArgument( new SrcMemberAccessExpression( _fqn, FIELD_FILE_URL ) ).name( "url" ) ) .addArgument( "feature", new SrcType( "String" ), node.getName() ) .addArgument( "offset", int.class, findOffsetOf( node ) ) .addArgument( "length", int.class, node.getName() == null ? 0 : node.getName().length() ); }
private void addGetValueMethod( SrcClass srcClass, FqnCacheNode<String> node ) { srcClass.addMethod( new SrcMethod( srcClass ) .name( "getValue" ) .modifiers( Modifier.PUBLIC | (isRootProperty( node ) ? Modifier.STATIC : 0) ) .returns( new SrcType( "String" ) ) .body( new SrcStatementBlock() .addStatement( new SrcReturnStatement( String.class, node.getUserData() ) ) ) ); }
private void addGetValueMethod( SrcClass srcClass, FqnCacheNode<String> node ) { srcClass.addMethod( new SrcMethod( srcClass ) .name( "getValue" ) .modifiers( Modifier.PUBLIC | (isRootProperty( node ) ? Modifier.STATIC : 0) ) .returns( new SrcType( "String" ) ) .body( new SrcStatementBlock() .addStatement( new SrcReturnStatement( String.class, node.getUserData() ) ) ) ); }