org.apache.isis.applib.Identifier.propertyOrCollectionIdentifier()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(11.8k)|赞(0)|评价(0)|浏览(95)

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

Identifier.propertyOrCollectionIdentifier介绍

暂无

代码示例

代码示例来源:origin: org.apache.isis.core/metamodel

private static Identifier propertyOrCollectionIdentifierFor(final Class<?> type, final Method method) {
  final String capitalizedName = NameUtils.javaBaseName(method.getName());
  final String beanName = Introspector.decapitalize(capitalizedName);
  return Identifier.propertyOrCollectionIdentifier(type.getName(), beanName);
}

代码示例来源:origin: org.apache.isis.runtimes.dflt/runtime

public TestProxyField(final String name, final ObjectSpecification spec) {
  this.name = name;
  this.spec = spec;
  identifier = Identifier.propertyOrCollectionIdentifier(spec.getFullIdentifier(), name);
  runtimeContext = new RuntimeContextNoRuntime();
}

代码示例来源:origin: org.apache.isis.core/progmodel

public void testNoLines() {
  final Identifier identifier = Identifier.propertyOrCollectionIdentifier("cls", "mth");
  final String s = manager.getHelpText(identifier);
  assertEquals("", s);
}

代码示例来源:origin: org.apache.isis.core/isis-core-metamodel

@Test
public void customEventType() throws Exception {
  SomeDomainObject sdo = new SomeDomainObject();
  Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "someDateProperty");
  LocalDate oldValue = new LocalDate(2013,4,1);
  LocalDate newValue = new LocalDate(2013,5,2);
  
  final PropertyDomainEvent<SomeDomainObject, LocalDate> ev =
      new DomainEventHelper(null).newPropertyDomainEvent(SomeDatePropertyChangedDomainEvent.class, identifier, sdo, oldValue, newValue);
  assertThat(ev.getSource(), is(sdo));
  assertThat(ev.getIdentifier(), is(identifier));
  assertThat(ev.getOldValue(), is(oldValue));
  assertThat(ev.getNewValue(), is(newValue));
}

代码示例来源:origin: org.apache.isis.core/isis-core-metamodel

@Test
public void defaultEventType() throws Exception {
  
  SomeDomainObject sdo = new SomeDomainObject();
  Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "someDateProperty");
  LocalDate oldValue = new LocalDate(2013,4,1);
  LocalDate newValue = new LocalDate(2013,5,2);
  
  final PropertyDomainEvent<Object, Object> ev =
      new DomainEventHelper(null).newPropertyDomainEvent(PropertyDomainEvent.Default.class, identifier, sdo, oldValue, newValue);
  assertThat(ev.getSource(), is((Object)sdo));
  assertThat(ev.getIdentifier(), is(identifier));
  assertThat(ev.getOldValue(), is((Object)oldValue));
  assertThat(ev.getNewValue(), is((Object)newValue));
}

代码示例来源:origin: org.apache.isis.core/isis-core-metamodel

@Test
public void customEventType() throws Exception {
  SomeDomainObject sdo = new SomeDomainObject();
  Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "someDateProperty");
  LocalDate oldValue = new LocalDate(2013,4,1);
  LocalDate newValue = null;
  
  final PropertyDomainEvent<SomeDomainObject, LocalDate> ev =
      new DomainEventHelper(null).newPropertyDomainEvent(SomeDatePropertyChangedDomainEvent.class, identifier, sdo, oldValue, newValue);
  assertThat(ev.getSource(), is(sdo));
  assertThat(ev.getIdentifier(), is(identifier));
  assertThat(ev.getOldValue(), is(oldValue));
  assertThat(ev.getNewValue(), is(nullValue()));
}

代码示例来源:origin: org.apache.isis.core/progmodel

public void testMessageForFileError() {
  final Identifier identifier = Identifier.propertyOrCollectionIdentifier("cls", "fld2");
  final HelpManagerUsingFiles manager = new HelpManagerUsingFiles(new IsisConfigurationDefault()) {
    @Override
    protected BufferedReader getReader() throws FileNotFoundException {
      throw new FileNotFoundException("not found");
    }
  };
  final String s = manager.getHelpText(identifier);
  assertEquals("Failure opening help file: not found", s);
}

代码示例来源:origin: org.apache.isis.core/isis-core-metamodel

@Test
public void defaultEventType() throws Exception {
  
  SomeDomainObject sdo = new SomeDomainObject();
  Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "someDateProperty");
  LocalDate oldValue = new LocalDate(2013,4,1);
  LocalDate newValue = null;
  
  final PropertyDomainEvent<Object, Object> ev =
      new DomainEventHelper(null).newPropertyDomainEvent(PropertyDomainEvent.Default.class, identifier, sdo, oldValue, newValue);
  assertThat(ev.getSource(), is((Object)sdo));
  assertThat(ev.getIdentifier(), is(identifier));
  assertThat(ev.getOldValue(), is((Object)oldValue));
  assertThat(ev.getNewValue(), is((Object)newValue));
}

代码示例来源:origin: org.apache.isis.core/progmodel

public void testFieldWithNoEntry() {
  manager.addLine("C:cls");
  manager.addLine("Help about class");
  final Identifier identifier = Identifier.propertyOrCollectionIdentifier("cls", "fld2");
  final String s = manager.getHelpText(identifier);
  assertEquals("", s);
}

代码示例来源:origin: org.apache.isis.runtimes.dflt/runtime

private void allowingPeerToReturnIdentifier() {
  context.checking(new Expectations() {
    {
      one(mockPeer).getIdentifier();
      will(returnValue(Identifier.propertyOrCollectionIdentifier(Customer.class, COLLECTION_ID)));
    }
  });
}

代码示例来源:origin: org.apache.isis.core/isis-core-metamodel

@Test
public void collectionAddedToDefaultEventType() throws Exception {
  final SomeDomainObject sdo = new SomeDomainObject();
  final SomeReferencedObject other = new SomeReferencedObject();
  final Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
  final CollectionDomainEvent<Object, Object> ev = new DomainEventHelper(null).newCollectionDomainEvent(
      CollectionAddedToEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.ADD_TO, other);
  assertThat(ev.getSource(), is((Object)sdo));
  assertThat(ev.getIdentifier(), is(identifier));
  assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
  assertThat(ev.getValue(), is((Object)other));
}

代码示例来源:origin: org.apache.isis.core/isis-core-metamodel

@Test
public void defaultEventType() throws Exception {
  SomeDomainObject sdo = new SomeDomainObject();
  SomeReferencedObject other = new SomeReferencedObject();
  Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
  final CollectionDomainEvent<Object, Object> ev = new DomainEventHelper(null).newCollectionDomainEvent(
      CollectionRemovedFromEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.REMOVE_FROM, other);
  assertThat(ev.getSource(), is((Object)sdo));
  assertThat(ev.getIdentifier(), is(identifier));
  assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));
  assertThat(ev.getValue(), is((Object)other));
}

代码示例来源:origin: org.apache.isis.core/isis-core-metamodel

@Test
public void collectionRemovedFromDefaultEventType() throws Exception {
  SomeDomainObject sdo = new SomeDomainObject();
  SomeReferencedObject other = new SomeReferencedObject();
  Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
  final CollectionDomainEvent<Object, Object> ev = new DomainEventHelper(null).newCollectionDomainEvent(
      CollectionRemovedFromEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.REMOVE_FROM, other);
  assertThat(ev.getSource(), is((Object)sdo));
  assertThat(ev.getIdentifier(), is(identifier));
  assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));
  assertThat(ev.getValue(), is((Object)other));
}

代码示例来源:origin: org.apache.isis.core/isis-core-metamodel

@Test
public void customEventType() throws Exception {
  SomeDomainObject sdo = new SomeDomainObject();
  SomeReferencedObject other = new SomeReferencedObject();
  Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
  final CollectionDomainEvent<SomeDomainObject, SomeReferencedObject> ev = new DomainEventHelper(null).newCollectionDomainEvent(
      SomeDomainObjectCollectionRemovedFromDomainEvent.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.REMOVE_FROM, other);
  assertThat(ev.getSource(), is(sdo));
  assertThat(ev.getIdentifier(), is(identifier));
  assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));
  assertThat(ev.getValue(), is(other));
}

代码示例来源:origin: org.apache.isis.core/isis-core-metamodel

@Test
public void defaultEventType() throws Exception {
  final SomeDomainObject sdo = new SomeDomainObject();
  final SomeReferencedObject other = new SomeReferencedObject();
  final Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
  final CollectionDomainEvent<Object, Object> ev = new DomainEventHelper(null).newCollectionDomainEvent(
      CollectionDomainEvent.Default.class, null, identifier, sdo, CollectionDomainEvent.Of.ADD_TO, other);
  assertThat(ev.getSource(), is((Object)sdo));
  assertThat(ev.getIdentifier(), is(identifier));
  assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
  assertThat(ev.getValue(), is((Object)other));
}

代码示例来源:origin: org.apache.isis.core/isis-core-metamodel

@Test
public void customEventType() throws Exception {
  final SomeDomainObject sdo = new SomeDomainObject();
  final SomeReferencedObject other = new SomeReferencedObject();
  final Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
  
  final CollectionDomainEvent<SomeDomainObject, SomeReferencedObject> ev = new DomainEventHelper(null).newCollectionDomainEvent(
      SomeDomainObjectCollectionDomainEvent.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.ADD_TO, other);
  assertThat(ev.getSource(), is(sdo));
  assertThat(ev.getIdentifier(), is(identifier));
  assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
  assertThat(ev.getValue(), is(other));
}

代码示例来源:origin: org.apache.isis.core/progmodel

public void testMethodTextStopsAtNextClass() {
  manager.addLine("C:cls");
  manager.addLine("M:fld");
  manager.addLine("Help about method");
  manager.addLine("C:cls2");
  manager.addLine("Different text");
  final Identifier identifier = Identifier.propertyOrCollectionIdentifier("cls", "fld");
  final String s = manager.getHelpText(identifier);
  assertEquals("Help about method\n", s);
}

代码示例来源:origin: org.apache.isis.core/progmodel

public void testMethodTextStopsAtNextMethod() {
  manager.addLine("C:cls");
  manager.addLine("M:fld");
  manager.addLine("Help about method");
  manager.addLine("M:fld2");
  manager.addLine("Different text");
  final Identifier identifier = Identifier.propertyOrCollectionIdentifier("cls", "fld");
  final String s = manager.getHelpText(identifier);
  assertEquals("Help about method\n", s);
}

代码示例来源:origin: org.apache.isis.core/progmodel

public void testField() {
  manager.addLine("C:cls");
  manager.addLine("Help about class");
  manager.addLine("M:fld1");
  manager.addLine("Help about field");
  manager.addLine("M:fld2");
  manager.addLine("Help about second field");
  final Identifier identifier = Identifier.propertyOrCollectionIdentifier("cls", "fld2");
  final String s = manager.getHelpText(identifier);
  assertEquals("Help about second field\n", s);
}

代码示例来源:origin: org.apache.isis.core/isis-core-metamodel

@Before
public void setUp() throws Exception {
  identifiedHolder = new AbstractFacetFactoryTest.IdentifiedHolderImpl(Identifier.propertyOrCollectionIdentifier(Customer.class, "lastName"));
  context.checking(new Expectations() {{
    allowing(mockServicesInjector).lookupService(TranslationService.class);
    will(returnValue(mockTranslationService));
  }});
  requiresFirstLetterToBeUpperCase = new SpecificationRequiresFirstLetterToBeUpperCase();
  facetForSpecificationFirstLetterUpperCase = new MustSatisfySpecificationFromMustSatisfyAnnotationOnTypeFacet(Utils.listOf(requiresFirstLetterToBeUpperCase), identifiedHolder, mockServicesInjector);
  mockProposedObjectAdapter = context.mock(ObjectAdapter.class, "proposed");
}

相关文章