private void assertValidTypeCategory(TypeCategory typeCategory) { // there might no need of 'typeCategory' in this implementation for // certain API, but for a distributed cache, it might help for the // implementers to partition the types per their category // while persisting so that look can be efficient if (typeCategory == null) { throw new IllegalArgumentException("Category of the types to be filtered is null."); } if (!validTypeFilterCategories.contains(typeCategory)) { throw new IllegalArgumentException("Category of the types should be one of " + StringUtils.join(validTypeFilterCategories, ", ")); } }
private void assertValidTypeCategory(TypeCategory typeCategory) { // there might no need of 'typeCategory' in this implementation for // certain API, but for a distributed cache, it might help for the // implementers to partition the types per their category // while persisting so that look can be efficient if (typeCategory == null) { throw new IllegalArgumentException("Category of the types to be filtered is null."); } if (!validTypeFilterCategories.contains(typeCategory)) { throw new IllegalArgumentException("Category of the types should be one of " + StringUtils.join(validTypeFilterCategories, ", ")); } }
@VisibleForTesting public boolean isTypeVertex(AtlasVertex vertex, TypeCategory category) { boolean ret = false; if (isTypeVertex(vertex)) { Object objTypeCategory = vertex.getProperty(Constants.TYPE_CATEGORY_PROPERTY_KEY, Object.class); TypeCategory vertexCategory = null; if(objTypeCategory instanceof TypeCategory) { vertexCategory = (TypeCategory) objTypeCategory; } else if (objTypeCategory != null) { vertexCategory = TypeCategory.valueOf(objTypeCategory.toString()); } ret = category.equals(vertexCategory); } return ret; }
@VisibleForTesting public boolean isTypeVertex(AtlasVertex vertex, TypeCategory category) { boolean ret = false; if (isTypeVertex(vertex)) { Object objTypeCategory = vertex.getProperty(Constants.TYPE_CATEGORY_PROPERTY_KEY, Object.class); TypeCategory vertexCategory = null; if(objTypeCategory instanceof TypeCategory) { vertexCategory = (TypeCategory) objTypeCategory; } else if (objTypeCategory != null) { vertexCategory = TypeCategory.valueOf(objTypeCategory.toString()); } ret = category.equals(vertexCategory); } return ret; }