本文整理匯總了Java中com.redhat.lightblue.metadata.TypeResolver類的典型用法代碼示例。如果您正苦於以下問題:Java TypeResolver類的具體用法?Java TypeResolver怎麽用?Java TypeResolver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TypeResolver類屬於com.redhat.lightblue.metadata包,在下文中一共展示了TypeResolver類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getMd
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
public EntityMetadata getMd(String fname) {
//runValidJsonTest("json-schema/metadata/metadata.json", fname);
try {
JsonNode node = loadJsonNode(fname);
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
extensions.registerDataStoreParser("mongo", new MongoDataStoreParser<JsonNode>());
TypeResolver resolver = new DefaultTypes();
JSONMetadataParser parser = new JSONMetadataParser(extensions, resolver, nodeFactory);
EntityMetadata md = parser.parseEntityMetadata(node);
PredefinedFields.ensurePredefinedFields(md);
return md;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例2: getMd
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
public EntityMetadata getMd(String fname) throws Exception {
JsonNode node = loadJsonNode(fname);
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
extensions.registerDataStoreParser("mongo", new FakeMongoDataStoreParser<JsonNode>());
TypeResolver resolver = new DefaultTypes();
JSONMetadataParser parser = new JSONMetadataParser(extensions, resolver, JsonNodeFactory.instance);
EntityMetadata md = parser.parseEntityMetadata(node);
PredefinedFields.ensurePredefinedFields(md);
return md;
}
示例3: getMd
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
public EntityMetadata getMd(String fname) throws Exception {
JsonNode node = loadJsonNode(fname);
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
extensions.registerDataStoreParser("mongo", new MongoDataStoreParser<JsonNode>());
TypeResolver resolver = new DefaultTypes();
JSONMetadataParser parser = new JSONMetadataParser(extensions, resolver, nodeFactory);
EntityMetadata emd = parser.parseEntityMetadata(node);
PredefinedFields.ensurePredefinedFields(emd);
return emd;
}
示例4: getMd
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
private EntityMetadata getMd(String fname) {
try {
JsonNode node = loadJsonNode(fname);
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
extensions.registerDataStoreParser("mongo", new TestDataStoreParser<JsonNode>());
TypeResolver resolver = new DefaultTypes();
JSONMetadataParser parser = new JSONMetadataParser(extensions, resolver, JsonNodeFactory.instance);
EntityMetadata md = parser.parseEntityMetadata(node);
PredefinedFields.ensurePredefinedFields(md);
return md;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例5: getMd
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
private EntityMetadata getMd(String fname) throws Exception {
JsonNode node = loadJsonNode(fname);
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
extensions.registerDataStoreParser("mongo", new TestDataStoreParser<JsonNode>());
TypeResolver resolver = new DefaultTypes();
JSONMetadataParser parser = new JSONMetadataParser(extensions, resolver, factory);
return parser.parseEntityMetadata(node);
}
示例6: getMd
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
private EntityMetadata getMd(String fname) {
try {
JsonNode node = loadJsonNode(fname);
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
extensions.registerDataStoreParser("mongo", new TestDataStoreParser<JsonNode>());
TypeResolver resolver = new DefaultTypes();
JSONMetadataParser parser = new JSONMetadataParser(extensions, resolver, nodeFactory);
EntityMetadata md = parser.parseEntityMetadata(node);
PredefinedFields.ensurePredefinedFields(md);
return md;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例7: getMd
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
private EntityMetadata getMd(String fname) throws Exception {
JsonNode node = loadJsonNode(fname);
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
extensions.registerDataStoreParser("mongo", new TestDataStoreParser<JsonNode>());
TypeResolver resolver = new DefaultTypes();
JSONMetadataParser parser = new JSONMetadataParser(extensions, resolver, JsonNodeFactory.instance);
return parser.parseEntityMetadata(node);
}
示例8: getMd
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
public static EntityMetadata getMd(String fname) throws Exception {
JsonNode node = loadJsonNode(fname);
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
extensions.registerDataStoreParser("mongo", new TestDataStoreParser<JsonNode>());
TypeResolver resolver = new DefaultTypes();
JSONMetadataParser parser = new JSONMetadataParser(extensions, resolver, factory);
EntityMetadata md = parser.parseEntityMetadata(node);
PredefinedFields.ensurePredefinedFields(md);
return md;
}
示例9: getMD
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
private EntityMetadata getMD(String fname) throws Exception {
JsonNode node = loadJsonNode(fname);
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
extensions.registerDataStoreParser("mongo", new TestDataStoreParser<JsonNode>());
TypeResolver typeResolver = new DefaultTypes();
JSONMetadataParser parser = new JSONMetadataParser(extensions, typeResolver, nodeFactory);
EntityMetadata md = parser.parseEntityMetadata(node);
PredefinedFields.ensurePredefinedFields(md);
return md;
}
示例10: BSONParser
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
public BSONParser(Extensions<Object> ex,
TypeResolver resolver) {
super(ex, resolver);
}
示例11: fillDefaults
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
/**
* Given the parameter values supplied by the caller, returns a
* map containing default values for missing parameters. If there
* are missing required parameters, throws an Error with missing
* parameters.
*/
public static Map<String,String> fillDefaults(JsonNode savedSearch,
Map<String,String> parameterValues,
TypeResolver types) {
Map<String,String> ret=new HashMap<>();
JsonNode parametersNode=savedSearch.get("parameters");
if(parametersNode instanceof ArrayNode) {
for(Iterator<JsonNode> itr=parametersNode.elements();itr.hasNext();) {
JsonNode parameterNode=itr.next();
if(parameterNode instanceof ObjectNode) {
Type type=null;
JsonNode x=parameterNode.get("name");
String name=x.asText();
x=parameterNode.get("type");
if(x!=null) {
type=types.getType(x.asText());
if(type==null) {
throw Error.get(ERR_SAVED_SEARCH_INVALID_TYPE,x.asText());
}
} else {
type=StringType.TYPE;
}
boolean optional=false;
x=parameterNode.get("optional");
if(x!=null) {
optional=x.asBoolean();
}
if(parameterValues.containsKey(name)) {
ret.put(name,(String)StringType.TYPE.cast(type.cast(parameterValues.get(name))));
} else if(optional) {
// Fill it in using default value
JsonNode defaultValue=parameterNode.get("defaultValue");
if(defaultValue==null)
throw Error.get(ERR_SAVED_SEARCH_NO_DEFAULT_VALUE,name);
ret.put(name,(String)StringType.TYPE.cast(type.fromJson(defaultValue)));
} else {
throw Error.get(ERR_SAVED_SEARCH_MISSING_PARAM,name);
}
}
}
}
return ret;
}
示例12: MetadataParser
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
public MetadataParser(Extensions<T> ex, TypeResolver typeResolver) {
this.extensions = ex;
this.typeResolver = typeResolver;
}
示例13: JSONMetadataParser
import com.redhat.lightblue.metadata.TypeResolver; //導入依賴的package包/類
public JSONMetadataParser(Extensions<JsonNode> ex,
TypeResolver resolver,
JsonNodeFactory factory) {
super(ex, resolver);
this.factory = factory;
}