public T newInstance( Module module ) { ValueBuilder<T> builder = module.newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } }
private AnotherValue createAnotherValue( String val1, String val2 ) { ValueBuilder<AnotherValue> valueBuilder = module.newValueBuilder( AnotherValue.class ); valueBuilder.prototype().val1().set( val1 ); valueBuilder.prototypeFor( AnotherValueInternalState.class ).val2().set( val2 ); return valueBuilder.newInstance(); }
@SuppressWarnings( "unchecked" ) private <T> T createInstance( ValueBuilder<?> builder ) { return (T) builder.newInstance(); } }
public TableBuilder paging() { // Paging int start = 0; int end = tableBuilder.prototype().rows().get().size(); if (tableQuery.offset() != null) start = Integer.parseInt(tableQuery.offset()); if (tableQuery.limit() != null) end = Math.min(end, start + Integer.parseInt(tableQuery.limit())); if (!(start == 0 && end == tableBuilder.prototype().rows().get().size())) tableBuilder.prototype().rows().set(tableBuilder.prototype().rows().get().subList(start, end)); return this; }
if ( keyUsages != null ) { profile.keyUsages().set( vbf.newValueBuilder( KeyUsagesValue.class ). withPrototype( keyUsages ).newInstance() ); withPrototype( extendedKeyUsages ).newInstance() ); withPrototype( netscapeCertTypes ).newInstance() ); withPrototype( basicConstraints ).newInstance() ); withPrototype( nameConstraints ).newInstance() );
public Links newLinks() { return linksBuilder.newInstance(); } }
public T addLink( Link link ) { linksBuilder.prototype().links().get().add( link ); linkBuilder = vbf.newValueBuilderWithPrototype( link ); return (T) this; }
public TableQuery newQuery() { String query = ""; if (select != null) query+= "select "+select.toString(); queryBuilder.prototype().tq().set( query ); return queryBuilder.newInstance(); } }
public Table newTable() { if (rowBuilder != null) endRow(); return tableBuilder.newInstance(); }
@Override @SuppressWarnings( "unchecked" ) public <T> T convert( final Class<T> valueType, Object entity, Function<T, T> prototypeOpportunity ) { ValueBuilder<?> builder = doConversion( valueType, entity ); prototypeOpportunity.map( (T) builder.prototype() ); return createInstance( builder ); }
public TableBuilder endRow() { tableBuilder.prototype().rows().get().add(rowBuilder.newInstance()); rowBuilder = null; return this; }
return builder.newInstance();
public TableBuilder cell(Object v, String f) { ValueBuilder<Cell> cellBuilder = vbf.newValueBuilder(Cell.class); cellBuilder.prototype().v().set(v); cellBuilder.prototype().f().set(f); rowBuilder.prototype().c().get().add(cellBuilder.newInstance()); return this; }
for (Column column : tableBuilder.prototype().cols().get())
public T addLink( String description, String id, String rel, String href, String classes ) { linkBuilder.prototype().text().set( description ); linkBuilder.prototype().id().set( id ); linkBuilder.prototype().rel().set( rel ); linkBuilder.prototype().href().set( href ); linkBuilder.prototype().classes().set( classes ); addLink( linkBuilder.newInstance() ); return (T) this; }
public TableBuilder column(String id, String label, String type) { ValueBuilder<Column> builder = vbf.newValueBuilder(Column.class); builder.prototype().id().set(id); if (tableQuery != null && tableQuery.label() != null) { // TODO Fix label selection } builder.prototype().label().set(label); builder.prototype().columnType().set(type); tableBuilder.prototype().cols().get().add(builder.newInstance()); return this; }
private SomeValue newSomeValue( String foo, String cathedral ) { ValueBuilder<SomeValue> builder = module.newValueBuilder( SomeValue.class ); SomeValue value = builder.prototype(); value.foo().set( foo ); if( cathedral != null ) { value.cathedral().set( cathedral ); } return builder.newInstance(); } }
public T addLink( String description, String id ) { try { linkBuilder.prototype().text().set( description ); linkBuilder.prototype().id().set( id ); if( command != null ) { linkBuilder.prototype().href().set( command + "?entity=" + id ); } else { linkBuilder.prototype() .href() .set( ( path == null ? "" : path + "/" ) + URLEncoder.encode( id, "UTF-8" ) + "/" ); } linkBuilder.prototype().rel().set( rel ); linkBuilder.prototype().classes().set( classes ); addLink( linkBuilder.newInstance() ); return (T) this; } catch( UnsupportedEncodingException e ) { e.printStackTrace(); return (T) this; } }
@Override public RestListValue newListRepresentationValue( Reference listRef, int start, Iterable<RestValue> items ) { ValueBuilder<RestListValue> builder = vbf.newValueBuilder( RestListValue.class ); RestListValue listRepresentation = builder.prototype(); listRepresentation.uri().set( listRef.toString() ); listRepresentation.start().set( start ); for ( RestValue eachItem : items ) { listRepresentation.items().get().add( eachItem ); } return builder.newInstance(); }