當前位置: 首頁>>代碼示例>>Java>>正文


Java Predicate1類代碼示例

本文整理匯總了Java中org.core4j.Predicate1的典型用法代碼示例。如果您正苦於以下問題:Java Predicate1類的具體用法?Java Predicate1怎麽用?Java Predicate1使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Predicate1類屬於org.core4j包,在下文中一共展示了Predicate1類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEdmEntitySet

import org.core4j.Predicate1; //導入依賴的package包/類
public EdmEntitySet getEdmEntitySet(final EdmEntityType type) {
  if (type == null)
    throw new IllegalArgumentException("type cannot be null");
  EdmEntitySet ees = Enumerable.create(getEntitySets())
      .firstOrNull(new Predicate1<EdmEntitySet>() {
        @Override
        public boolean apply(EdmEntitySet input) {
          return type.equals(input.getType());
        }
      });

  if (ees != null) {
    return ees;
  }
  throw new NotFoundException("EdmEntitySet " + type.getName() + " is not found");
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:17,代碼來源:EdmDataServices.java

示例2: testFunctionConsumer

import org.core4j.Predicate1; //導入依賴的package包/類
protected void testFunctionConsumer(String functionName, EdmType expectedType, int nExpected, Predicate1<OObject> alsoTrue) {
  for (FormatType format : ServiceOperationsTest.formats) {
    if (format.equals(FormatType.ATOM)) {
      continue;
    } // maybe someday.
    ODataConsumer consumer = rtFacade.createODataConsumer(endpointUri, format, null);
    Enumerable<OObject> objects = consumer.callFunction(functionName).execute();

    assertEquals(nExpected, objects.count());
    for (OObject obj : objects) {
      assertEquals(obj.getType(), expectedType);
      if (null != alsoTrue) {
        assertTrue(alsoTrue.apply(obj));
      }
    }
  }
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:18,代碼來源:ServiceOperationsTest.java

示例3: testFunctionReturnComplexTypeConsumer

import org.core4j.Predicate1; //導入依賴的package包/類
@Test
public void testFunctionReturnComplexTypeConsumer() {

  testFunctionConsumer(ServiceOperationsMetadataUtil.TEST_FUNCTION_RETURN_COMPLEX_TYPE,
      mockProducer.getMetadata().findEdmComplexType(ServiceOperationsProducerMock.COMPLEY_TYPE_NAME_LOCATION),
      1,
      new Predicate1<OObject>() {

        @Override
        public boolean apply(OObject t) {
          OComplexObject e = (OComplexObject) t;
          // weird that e.getProperty("City") returns a property list and not a complex object.
          // and furthermore...why is List<OProperty<?>> used...there should be a PropertyBag abstraction no?
          OComplexObject city = OComplexObjects.create(mockProducer.getMetadata().findEdmComplexType(ServiceOperationsProducerMock.COMPLEY_TYPE_NAME_CITY), e.getProperty("City", List.class).getValue());
          return e.getProperty("Country", String.class).getValue().equals(ServiceOperationsProducerMock.COUNTRY)
              && city.getProperty("PostalCode", String.class).getValue().equals(ServiceOperationsProducerMock.POSTAL_CODE)
              && city.getProperty("CityName", String.class).getValue().equals(ServiceOperationsProducerMock.CITY);
        }
      });
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:21,代碼來源:ServiceOperationsTest.java

示例4: testFunctionReturnCollectionStringConsumer

import org.core4j.Predicate1; //導入依賴的package包/類
@Test
public void testFunctionReturnCollectionStringConsumer() {

  testFunctionConsumer(ServiceOperationsMetadataUtil.TEST_FUNCTION_RETURN_COLLECTION_STRING,
      EdmSimpleType.STRING,
      2,
      new Predicate1<OObject>() {

        @Override
        public boolean apply(OObject t) {
          String s = ((OSimpleObject) t).getValue().toString();
          return ServiceOperationsProducerMock.COLLECTION_STRING1.equals(s) ||
              ServiceOperationsProducerMock.COLLECTION_STRING2.equals(s);
        }
      });
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:17,代碼來源:ServiceOperationsTest.java

示例5: testFunctionReturnCollectionEntityTypeConsumer

import org.core4j.Predicate1; //導入依賴的package包/類
@Test
public void testFunctionReturnCollectionEntityTypeConsumer() {

  testFunctionConsumer(ServiceOperationsMetadataUtil.TEST_FUNCTION_RETURN_COLLECTION_ENTITY,
      mockProducer.getMetadata().findEdmEntitySet("Employees").getType(),
      1,
      new Predicate1<OObject>() {

        @Override
        public boolean apply(OObject t) {
          OEntity e = (OEntity) t;
          return e.getProperty("EmployeeName", String.class).getValue().equals(ServiceOperationsProducerMock.EMPLOYEE_NAME)
              && e.getProperty("EmployeeId", String.class).getValue().equals(ServiceOperationsProducerMock.EMPLOYEE_ID);
        }
      });
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:17,代碼來源:ServiceOperationsTest.java

示例6: graphNameEquals

import org.core4j.Predicate1; //導入依賴的package包/類
private static final Predicate1<RdfSchema> graphNameEquals(final String graphName) {
	return new Predicate1<RdfSchema>() {
		public boolean apply(RdfSchema graph) {
			return graph.schemaName.equals(graphName);
		}
	};
}
 
開發者ID:peterjohnlawrence,項目名稱:com.inova8.odata2sparql.v4,代碼行數:8,代碼來源:RdfModel.java

示例7: classNameEquals

import org.core4j.Predicate1; //導入依賴的package包/類
private static final Predicate1<RdfEntityType> classNameEquals(final String className) {
	return new Predicate1<RdfEntityType>() {
		public boolean apply(RdfEntityType clazz) {
			return clazz.entityTypeName.equals(className);
		}
	};
}
 
開發者ID:peterjohnlawrence,項目名稱:com.inova8.odata2sparql.v4,代碼行數:8,代碼來源:RdfModel.java

示例8: propertyNameEquals

import org.core4j.Predicate1; //導入依賴的package包/類
private static final Predicate1<RdfProperty> propertyNameEquals(final String propertyName) {
	return new Predicate1<RdfProperty>() {
		public boolean apply(RdfProperty property) {
			return property.propertyName.equals(propertyName);
		}
	};
}
 
開發者ID:peterjohnlawrence,項目名稱:com.inova8.odata2sparql.v4,代碼行數:8,代碼來源:RdfModel.java

示例9: associationNameEquals

import org.core4j.Predicate1; //導入依賴的package包/類
private static final Predicate1<RdfAssociation> associationNameEquals(final String associationName) {
	return new Predicate1<RdfAssociation>() {
		public boolean apply(RdfAssociation association) {
			return association.associationName.equals(associationName);
		}
	};
}
 
開發者ID:peterjohnlawrence,項目名稱:com.inova8.odata2sparql.v4,代碼行數:8,代碼來源:RdfModel.java

示例10: datatypeNameEquals

import org.core4j.Predicate1; //導入依賴的package包/類
private static final Predicate1<RdfDatatype> datatypeNameEquals(final String datatypeName) {
	return new Predicate1<RdfDatatype>() {
		public boolean apply(RdfDatatype datatype) {
			return datatype.datatypeName.equals(datatypeName);
		}
	};
}
 
開發者ID:peterjohnlawrence,項目名稱:com.inova8.odata2sparql.v4,代碼行數:8,代碼來源:RdfModel.java

示例11: pred1_byQName

import org.core4j.Predicate1; //導入依賴的package包/類
public static Predicate1<Attribute2> pred1_byQName(final QName2 name) {
  return new Predicate1<Attribute2>() {
    @Override
    public boolean apply(Attribute2 attribute) {
      return equal(attribute.getName().getNamespaceUri(), name.getNamespaceUri()) && equal(attribute.getName().getLocalPart(), name.getLocalPart());
    }
  };
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:9,代碼來源:InMemoryAttribute2.java

示例12: pred1_byName

import org.core4j.Predicate1; //導入依賴的package包/類
public static Predicate1<Attribute2> pred1_byName(final String name) {
  return new Predicate1<Attribute2>() {
    @Override
    public boolean apply(Attribute2 attribute) {
      return attribute.getName().getLocalPart().equals(name);
    }
  };
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:9,代碼來源:InMemoryAttribute2.java

示例13: getRequest

import org.core4j.Predicate1; //導入依賴的package包/類
private ODataClientRequest getRequest() {
  List<OProperty<?>> requestProps = props;
  if (updateRoot != null) {
    OEntity updateRootEntity = (OEntity) updateRoot;
    requestProps = Enumerable.create(updateRootEntity.getProperties()).toList();
    for (final OProperty<?> prop : props) {
      OProperty<?> requestProp = Enumerable.create(requestProps).firstOrNull(new Predicate1<OProperty<?>>() {
        public boolean apply(OProperty<?> input) {
          return input.getName().equals(prop.getName());
        }
      });
      requestProps.remove(requestProp);
      requestProps.add(prop);
    }
  }

  OEntityKey entityKey = Enumerable.create(segments).last().key;
  Entry entry = client.createRequestEntry(entitySet, entityKey, requestProps, links);

  String path = Enumerable.create(segments).join("/");

  ODataClientRequest request = updateRoot != null ?
      ODataClientRequest.put(serviceRootUri + path, entry) :
      ODataClientRequest.merge(serviceRootUri + path, entry);

  // if this is update request (w/o stream) then send it as merge
  if (Boolean.TRUE.equals(entitySet.getType().getHasStream())) {
    request = ODataClientRequest.merge(serviceRootUri + path, entry);
  }
  if (ifMatch != null)
    request.header(Headers.IF_MATCH, ifMatch);

  return request;
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:35,代碼來源:ConsumerEntityModificationRequest.java

示例14: pred1_hasAlias

import org.core4j.Predicate1; //導入依賴的package包/類
public static Predicate1<Builder> pred1_hasAlias() {
  return new Predicate1<EdmEntityType.Builder>() {
    @Override
    public boolean apply(Builder input) {
      return input.getAlias() != null;
    }
  };
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:9,代碼來源:EdmEntityType.java

示例15: entityPropertyValueEquals

import org.core4j.Predicate1; //導入依賴的package包/類
public static Predicate1<OEntity> entityPropertyValueEquals(final String propName, final Object value) {
  return new Predicate1<OEntity>() {
    @Override
    public boolean apply(OEntity input) {
      Object pv = input.getProperty(propName).getValue();
      return (value == null) ? pv == null : value.equals(pv);
    }
  };
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:10,代碼來源:OPredicates.java


注:本文中的org.core4j.Predicate1類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。