当前位置: 首页>>代码示例>>Java>>正文


Java Type.value方法代码示例

本文整理汇总了Java中org.xbill.DNS.Type.value方法的典型用法代码示例。如果您正苦于以下问题:Java Type.value方法的具体用法?Java Type.value怎么用?Java Type.value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xbill.DNS.Type的用法示例。


在下文中一共展示了Type.value方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import org.xbill.DNS.Type; //导入方法依赖的package包/类
@Override
public void process(Exchange exchange) throws Exception {
    String dnsName = exchange.getIn().getHeader(DnsConstants.DNS_NAME, String.class);
    ObjectHelper.notEmpty(dnsName, "Header " + DnsConstants.DNS_NAME);

    Object type = exchange.getIn().getHeader(DnsConstants.DNS_TYPE);
    Integer dnsType = null;
    if (type != null) {
        dnsType = Type.value(String.valueOf(type));
    }
    Object dclass = exchange.getIn().getHeader(DnsConstants.DNS_CLASS);
    Integer dnsClass = null;
    if (dclass != null) {
        dnsClass = DClass.value(String.valueOf(dclass));
    }

    Lookup lookup = (dnsClass == null)
            ? (dnsType == null ? new Lookup(dnsName) : new Lookup(dnsName, dnsType))
            : new Lookup(dnsName, dnsType, dnsClass);

    lookup.run();
    if (lookup.getAnswers() != null) {
        exchange.getIn().setBody(lookup.getAnswers());
    } else {
        throw new CamelException(lookup.getErrorString());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:28,代码来源:DnsLookupProducer.java

示例2: process

import org.xbill.DNS.Type; //导入方法依赖的package包/类
@Override
public void process(Exchange exchange) throws Exception {
    String server = exchange.getIn().getHeader(DnsConstants.DNS_SERVER, String.class);

    SimpleResolver resolver = new SimpleResolver(server);
    int type = Type.value(exchange.getIn().getHeader(DnsConstants.DNS_TYPE, String.class));
    if (type == -1) {
        // default: if unparsable value given, use A.
        type = Type.A;
    }

    String dclassValue = exchange.getIn().getHeader(DnsConstants.DNS_CLASS, String.class);
    if (dclassValue == null) {
        dclassValue = "";
    }

    int dclass = DClass.value(dclassValue);
    if (dclass == -1) {
        // by default, value is IN.
        dclass = DClass.IN;
    }

    Name name = Name.fromString(exchange.getIn().getHeader(DnsConstants.DNS_NAME, String.class), Name.root);
    Record rec = Record.newRecord(name, type, dclass);
    Message query = Message.newQuery(rec);
    Message response = resolver.send(query);
    exchange.getIn().setBody(response);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:29,代码来源:DnsDigProducer.java

示例3: parseQuestion

import org.xbill.DNS.Type; //导入方法依赖的package包/类
private Record parseQuestion(String line) throws TextParseException {
    String[] temp = line.replaceAll("\\s+", " ").split(" ");
    if (Type.value(temp[2]) == -1) {
        System.out.println(temp[2]);
    }

    return Record.newRecord(Name.fromString(temp[0]), Type.value(temp[2]), DClass.value(temp[1]));
}
 
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:9,代码来源:RplParser.java

示例4: onItemSelected

import org.xbill.DNS.Type; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    String selected = (String) (((Spinner) findViewById(R.id.spinnerKnownTypes))).getSelectedItem();
    String selectedNumber = "" + Type.value(selected);
    (((EditText) findViewById(R.id.txtQTYPE))).setText(selectedNumber);
}
 
开发者ID:gryphius,项目名称:androdns,代码行数:7,代码来源:DNSFormActivity.java

示例5: DNSLookupEntry

import org.xbill.DNS.Type; //导入方法依赖的package包/类
public DNSLookupEntry(String name, String type) throws TextParseException{
	this(name, Type.value(type));
}
 
开发者ID:PRTG,项目名称:JMXMiniProbe,代码行数:4,代码来源:DNSLookupEntry.java


注:本文中的org.xbill.DNS.Type.value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。