org.apache.polygene.api.association.Association.set()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.apache.polygene.api.association.Association.set()方法的一些代码示例,展示了Association.set()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Association.set()方法的具体详情如下:
包路径:org.apache.polygene.api.association.Association
类名称:Association
方法名:set

Association.set介绍

[英]Set the associated entity.
[中]

代码示例

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.api

@Override
public void set( Object associated )
  throws IllegalArgumentException
{
  next.set( associated );
}

代码示例来源:origin: apache/attic-polygene-java

public void changeOwner( Person owner )
  {
    state.owner().set( owner );
  }
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
  public void amendAddress( String street, String zipCode, City city, Country country )
  {
    Address newAddress = repository.createAddress( street, zipCode, city, country, address().get().rent().get() );
    address().set( newAddress );
  }
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
public void movedToNewAddress( String street, String zipCode, City city, Country country, Rent rent )
{
  Address newAddress = repository.createAddress( street, zipCode, city, country, rent );
  Address oldAddress = address().get();
  oldAddresses().add( oldAddress );
  address().set( newAddress );
}

代码示例来源:origin: apache/attic-polygene-java

@Override
  public void amendAddress( String street, String zipCode, City city, Country country )
  {
    Address newAddress = repository.createAddress( street, zipCode, city, country, address().get().rent().get() );
    address().set( newAddress );
  }
}

代码示例来源:origin: apache/attic-polygene-java

@Test( expected = ConstraintViolationException.class )
public void whenNullingNonOptionalAssociationExpectFailure()
{
  try( UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "Test - whenNullingOptionalAssociationExpectSuccess" ) ) )
  {
    Person toni = peopleRepository.findPersonByName( "Toni" );
    toni.nationality().set( null );
    uow.complete();
  }
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test
public void whenNullingOptionalAssociationExpectSuccess()
{
  try( UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "Test - whenNullingOptionalAssociationExpectSuccess" ) ) )
  {
    Person toni = peopleRepository.findPersonByName( "Toni" );
    toni.spouse().set( null );
    uow.complete();
  }
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Test( expected = ConstraintViolationException.class )
public void whenNullingNonOptionalAssociationExpectFailure()
{
  try( UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "Test - whenNullingOptionalAssociationExpectSuccess" ) ) )
  {
    Person toni = peopleRepository.findPersonByName( "Toni" );
    toni.nationality().set( null );
    uow.complete();
  }
}

代码示例来源:origin: apache/attic-polygene-java

@Test
public void whenNullingOptionalAssociationExpectSuccess()
{
  try( UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( UsecaseBuilder.newUsecase( "Test - whenNullingOptionalAssociationExpectSuccess" ) ) )
  {
    Person toni = peopleRepository.findPersonByName( "Toni" );
    toni.spouse().set( null );
    uow.complete();
  }
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

private WillPercentage createPercentage( Person beneficiary, Float percentage )
{
  ValueBuilder<WillPercentage> builder = vbf.newValueBuilder( WillPercentage.class );
  builder.prototype().percentage().set( percentage );
  builder.prototype().beneficiary().set( beneficiary );
  return builder.newInstance();
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

private WillAmount createAmount( Person beneficiary, Currency amount )
{
  ValueBuilder<WillAmount> builder = vbf.newValueBuilder( WillAmount.class );
  builder.prototype().amount().set( amount );
  builder.prototype().beneficiary().set( beneficiary );
  return builder.newInstance();
}

代码示例来源:origin: apache/attic-polygene-java

private WillAmount createAmount( Person beneficiary, Currency amount )
{
  ValueBuilder<WillAmount> builder = vbf.newValueBuilder( WillAmount.class );
  builder.prototype().amount().set( amount );
  builder.prototype().beneficiary().set( beneficiary );
  return builder.newInstance();
}

代码示例来源:origin: apache/attic-polygene-java

private WillPercentage createPercentage( Person beneficiary, Float percentage )
{
  ValueBuilder<WillPercentage> builder = vbf.newValueBuilder( WillPercentage.class );
  builder.prototype().percentage().set( percentage );
  builder.prototype().beneficiary().set( beneficiary );
  return builder.newInstance();
}

代码示例来源:origin: apache/attic-polygene-java

public WillPercentage createPercentage( Person beneficiary, float percentage )
{
  ValueBuilder<WillPercentage> builder = vbf.newValueBuilder( WillPercentage.class );
  builder.prototype().beneficiary().set( beneficiary );
  builder.prototype().percentage().set( percentage );
  return builder.newInstance();
}

代码示例来源:origin: apache/attic-polygene-java

public Car create( Manufacturer manufacturer, String model )
  {
    UnitOfWork uow = unitOfWorkFactory.currentUnitOfWork();
    EntityBuilder<Car> builder = uow.newEntityBuilder( Car.class );

    Car prototype = builder.instance();
    prototype.manufacturer().set( manufacturer );
    prototype.model().set( model );

    return builder.newInstance();
  }
// END SNIPPET: create

代码示例来源:origin: apache/attic-polygene-java

Post reply( String message, PostView viewPost )
  {
    Post post = uowf.currentUnitOfWork().newEntity( Post.class );
    post.message().set( message );
    post.createdBy().set( poster.self() );
    post.createdOn().set( uowf.currentUnitOfWork().currentTime() );
    post.replyTo().set( viewPost.self() );
    self().lastPost().set( post );
    Numbers.add( self().postCount(), 1 );
    return post;
  }
}

代码示例来源:origin: apache/attic-polygene-java

private WillItem createItem( Person beneficiary, String item, String description )
{
  ValueBuilder<WillItem> builder = vbf.newValueBuilder( WillItem.class );
  builder.prototype().item().set( item );
  builder.prototype().description().set( description );
  builder.prototype().beneficiary().set( beneficiary );
  return builder.newInstance();
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

private WillItem createItem( Person beneficiary, String item, String description )
{
  ValueBuilder<WillItem> builder = vbf.newValueBuilder( WillItem.class );
  builder.prototype().item().set( item );
  builder.prototype().description().set( description );
  builder.prototype().beneficiary().set( beneficiary );
  return builder.newInstance();
}

代码示例来源:origin: apache/attic-polygene-java

@Test
public void shouldBeAbleToSetLeadToTheResearchTeam()
{
  ResearchTeam startUp = valueBuilderFactory.newValue( ResearchTeam.class );
  ValueBuilder<Employee> builder = valueBuilderFactory.newValueBuilder( Employee.class );
  builder.prototype().identity().set(NICLAS);
  Employee niclas = builder.newInstance();
  startUp.lead().set( niclas );
}

代码示例来源:origin: apache/attic-polygene-java

private SomeWithAssociations buildSomeWithAssociation( AnEntity associated )
{
  SomeWithAssociations some;
  {
    ValueBuilder<SomeWithAssociations> builder = valueBuilderFactory.newValueBuilder( SomeWithAssociations.class );
    builder.prototype().anEntity().set( associated );
    builder.prototype().manyEntities().add( associated );
    builder.prototype().namedEntities().put( "someKey", associated );
    some = builder.newInstance();
  }
  return some;
}

相关文章

微信公众号

最新文章

更多