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


Java PropertyParser类代码示例

本文整理汇总了Java中com.espertech.esper.event.property.PropertyParser的典型用法代码示例。如果您正苦于以下问题:Java PropertyParser类的具体用法?Java PropertyParser怎么用?Java PropertyParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PropertyParser类属于com.espertech.esper.event.property包,在下文中一共展示了PropertyParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFragmentType

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
protected static FragmentEventType getFragmentType(Schema schema, String propertyName, Map<String, PropertySetDescriptorItem> propertyItems, EventAdapterService eventAdapterService) {
    String unescapePropName = ASTUtil.unescapeDot(propertyName);
    PropertySetDescriptorItem item = propertyItems.get(unescapePropName);
    if (item != null) {
        return item.getFragmentEventType();
    }

    Property property = PropertyParser.parseAndWalkLaxToSimple(propertyName);
    AvroFieldDescriptor desc = AvroFieldUtil.fieldForProperty(schema, property);
    if (desc == null) {
        return null;
    }
    if (desc.isDynamic()) {
        return null;
    }
    Schema fieldSchemaByAccess = desc.getField().schema();
    if (desc.isAccessedByIndex()) {
        fieldSchemaByAccess = fieldSchemaByAccess.getElementType();
    }
    return getFragmentEventTypeForField(fieldSchemaByAccess, eventAdapterService);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:22,代码来源:AvroFragmentTypeUtil.java

示例2: getWriter

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
public MapEventBeanPropertyWriter getWriter(String propertyName) {
    if (writablePropertyDescriptors == null) {
        initializeWriters();
    }
    Pair<EventPropertyDescriptor, MapEventBeanPropertyWriter> pair = propertyWriters.get(propertyName);
    if (pair != null) {
        return pair.getSecond();
    }

    Property property = PropertyParser.parseAndWalkLaxToSimple(propertyName);
    if (property instanceof MappedProperty) {
        MappedProperty mapProp = (MappedProperty) property;
        return new MapEventBeanPropertyWriterMapProp(mapProp.getPropertyNameAtomic(), mapProp.getKey());
    }

    if (property instanceof IndexedProperty) {
        IndexedProperty indexedProp = (IndexedProperty) property;
        return new MapEventBeanPropertyWriterIndexedProp(indexedProp.getPropertyNameAtomic(), indexedProp.getIndex());
    }

    return null;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:23,代码来源:MapEventType.java

示例3: getIndexedAndMappedProps

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
public static MapIndexedPropPair getIndexedAndMappedProps(String[] properties) {
    Set<String> mapPropertiesToCopy = new HashSet<String>();
    Set<String> arrayPropertiesToCopy = new HashSet<String>();
    for (int i = 0; i < properties.length; i++) {
        Property prop = PropertyParser.parseAndWalkLaxToSimple(properties[i]);
        if (prop instanceof MappedProperty) {
            MappedProperty mappedProperty = (MappedProperty) prop;
            mapPropertiesToCopy.add(mappedProperty.getPropertyNameAtomic());
        }
        if (prop instanceof IndexedProperty) {
            IndexedProperty indexedProperty = (IndexedProperty) prop;
            arrayPropertiesToCopy.add(indexedProperty.getPropertyNameAtomic());
        }
    }
    return new MapIndexedPropPair(mapPropertiesToCopy, arrayPropertiesToCopy);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:17,代码来源:BaseNestableEventUtil.java

示例4: getStreamIndex

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
private static Pair<Integer, String> getStreamIndex(String resolvedPropertyName) {
    Property property = PropertyParser.parseAndWalkLaxToSimple(resolvedPropertyName);
    if (!(property instanceof NestedProperty)) {
        throw new IllegalStateException("Expected a nested property providing an index for array match '" + resolvedPropertyName + "'");
    }
    NestedProperty nested = (NestedProperty) property;
    if (nested.getProperties().size() < 2) {
        throw new IllegalStateException("Expected a nested property name for array match '" + resolvedPropertyName + "', none found");
    }
    if (!(nested.getProperties().get(0) instanceof IndexedProperty)) {
        throw new IllegalStateException("Expected an indexed property for array match '" + resolvedPropertyName + "', please provide an index");
    }
    int index = ((IndexedProperty) nested.getProperties().get(0)).getIndex();
    nested.getProperties().remove(0);
    StringWriter writer = new StringWriter();
    nested.toPropertyEPL(writer);
    return new Pair<Integer, String>(index, writer.toString());
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:19,代码来源:FilterSpecCompilerMakeParamUtil.java

示例5: getWriter

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
public MapEventBeanPropertyWriter getWriter(String propertyName)
{
    if (writablePropertyDescriptors == null)
    {
        initializeWriters();
    }
    Pair<EventPropertyDescriptor, MapEventBeanPropertyWriter> pair = propertyWriters.get(propertyName);
    if (pair != null) {
        return pair.getSecond();
    }

    Property property = PropertyParser.parse(propertyName, false);
    if (property instanceof MappedProperty) {
        MappedProperty mapProp = (MappedProperty) property;
        return new MapEventBeanPropertyWriterMapProp(mapProp.getPropertyNameAtomic(), mapProp.getKey());
    }

    if (property instanceof IndexedProperty) {
        IndexedProperty indexedProp = (IndexedProperty) property;
        return new MapEventBeanPropertyWriterIndexedProp(indexedProp.getPropertyNameAtomic(), indexedProp.getIndex());
    }

    return null;
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:25,代码来源:MapEventType.java

示例6: getIndexedAndMappedProps

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
public static MapIndexedPropPair getIndexedAndMappedProps(String[] properties) {
    Set<String> mapPropertiesToCopy = new HashSet<String>();
    Set<String> arrayPropertiesToCopy = new HashSet<String>();
    for (int i = 0; i < properties.length; i++) {
        Property prop = PropertyParser.parse(properties[i], false);
        if (prop instanceof MappedProperty) {
            MappedProperty mappedProperty = (MappedProperty) prop;
            mapPropertiesToCopy.add(mappedProperty.getPropertyNameAtomic());
        }
        if (prop instanceof IndexedProperty) {
            IndexedProperty indexedProperty = (IndexedProperty) prop;
            arrayPropertiesToCopy.add(indexedProperty.getPropertyNameAtomic());
        }
    }
    return new MapIndexedPropPair(mapPropertiesToCopy, arrayPropertiesToCopy);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:17,代码来源:BaseNestableEventUtil.java

示例7: getStreamIndex

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
private static Pair<Integer, String> getStreamIndex(String resolvedPropertyName)
{
    Property property = PropertyParser.parse(resolvedPropertyName, false);
    if (!(property instanceof NestedProperty))
    {
        throw new IllegalStateException("Expected a nested property providing an index for array match '" + resolvedPropertyName + "'");
    }
    NestedProperty nested = ((NestedProperty) property);
    if (nested.getProperties().size() < 2)
    {
        throw new IllegalStateException("Expected a nested property name for array match '" + resolvedPropertyName + "', none found");
    }
    if (!(nested.getProperties().get(0) instanceof IndexedProperty))
    {
        throw new IllegalStateException("Expected an indexed property for array match '" + resolvedPropertyName + "', please provide an index");
    }
    int index = ((IndexedProperty) nested.getProperties().get(0)).getIndex();
    nested.getProperties().remove(0);
    StringWriter writer = new StringWriter();
    nested.toPropertyEPL(writer);
    return new Pair<Integer, String>(index, writer.toString());
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:23,代码来源:FilterSpecCompiler.java

示例8: getPropertyType

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
public Class getPropertyType(String propertyName) {
    PropertySetDescriptorItem item = propertyItems.get(ASTUtil.unescapeDot(propertyName));
    if (item != null) {
        return item.getSimplePropertyType();
    }

    Property property = PropertyParser.parseAndWalkLaxToSimple(propertyName);
    return AvroPropertyUtil.propertyType(avroSchema, property);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:10,代码来源:AvroEventType.java

示例9: doResolvePropertyType

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
protected Class doResolvePropertyType(String propertyExpression) {
    EsperEPL2GrammarParser.StartEventPropertyRuleContext ast = PropertyParser.parse(propertyExpression);
    if (PropertyParser.isPropertyDynamic(ast)) {
        return org.w3c.dom.Node.class;
    } else {
        return String.class;
    }
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:9,代码来源:SimpleXMLEventType.java

示例10: doResolvePropertyType

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
private Class doResolvePropertyType(String propertyExpression, boolean allowSimpleProperties) {

        // see if this is an indexed property
        int index = StringValue.unescapedIndexOfDot(propertyExpression);
        if ((!allowSimpleProperties) && (index == -1)) {
            // parse, can be an indexed property
            Property property = PropertyParser.parseAndWalkLaxToSimple(propertyExpression);
            if (!property.isDynamic()) {
                if (!(property instanceof IndexedProperty)) {
                    return null;
                }
                IndexedProperty indexedProp = (IndexedProperty) property;
                EventPropertyDescriptor descriptor = propertyDescriptorMap.get(indexedProp.getPropertyNameAtomic());
                if (descriptor == null) {
                    return null;
                }
                return descriptor.getPropertyType();
            }
        }

        Property prop = PropertyParser.parseAndWalkLaxToSimple(propertyExpression);
        if (prop.isDynamic()) {
            return Node.class;
        }

        SchemaItem item = prop.getPropertyTypeSchema(schemaModelRoot, this.getEventAdapterService());
        if (item == null) {
            return null;
        }

        return SchemaUtil.toReturnType(item);
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:33,代码来源:SchemaXMLEventType.java

示例11: validate

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
public void validate(ExprValidationContext validationContext) throws ExprValidationException
{
    String unescapedPropertyName = PropertyParser.unescapeBacktick(unresolvedPropertyName);
    Pair<PropertyResolutionDescriptor, String> propertyInfoPair = ExprIdentNodeUtil.getTypeFromStream(validationContext.getStreamTypeService(), unescapedPropertyName, streamOrPropertyName, false);
    resolvedStreamName = propertyInfoPair.getSecond();
    int streamNum = propertyInfoPair.getFirst().getStreamNum();
    Class propertyType = propertyInfoPair.getFirst().getPropertyType();
    resolvedPropertyName = propertyInfoPair.getFirst().getPropertyName();
    EventPropertyGetter propertyGetter;
    try {
        propertyGetter = propertyInfoPair.getFirst().getStreamEventType().getGetter(resolvedPropertyName);
    }
    catch (PropertyAccessException ex) {
        throw new ExprValidationException("Property '" + unresolvedPropertyName + "' is not valid: " + ex.getMessage(), ex);
    }

    if (propertyGetter == null)
    {
        throw new ExprValidationException("Property getter returned was invalid for property '" + unresolvedPropertyName + "'");
    }

    Audit audit = AuditEnum.PROPERTY.getAudit(validationContext.getAnnotations());
    if (audit != null) {
        evaluator = new ExprIdentNodeEvaluatorLogging(streamNum, propertyGetter, propertyType, resolvedPropertyName, validationContext.getStatementName(), validationContext.getStreamTypeService().getEngineURIQualifier());
    }
    else {
        evaluator = new ExprIdentNodeEvaluatorImpl(streamNum, propertyGetter, propertyType);
    }

    // if running in a context, take the property value from context
    if (validationContext.getContextDescriptor() != null) {
        EventType fromType = validationContext.getStreamTypeService().getEventTypes()[streamNum];
        String contextPropertyName = validationContext.getContextDescriptor().getContextPropertyRegistry().getPartitionContextPropertyName(fromType, resolvedPropertyName);
        if (contextPropertyName != null) {
            EventType contextType = validationContext.getContextDescriptor().getContextPropertyRegistry().getContextEventType();
            evaluator = new ExprIdentNodeEvaluatorContext(streamNum, contextType.getPropertyType(contextPropertyName), contextType.getGetter(contextPropertyName));
        }
    }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:40,代码来源:ExprIdentNodeImpl.java

示例12: toExpressionString

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
public String toExpressionString()
{
    StringBuilder buffer = new StringBuilder();
    if (streamOrPropertyName != null)
    {
        buffer.append(ASTFilterSpecHelper.unescapeDot(streamOrPropertyName)).append('.');
    }
    buffer.append(ASTFilterSpecHelper.unescapeDot(PropertyParser.unescapeBacktick(unresolvedPropertyName)));

    return buffer.toString();
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:12,代码来源:ExprIdentNodeImpl.java

示例13: doResolvePropertyType

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
protected Class doResolvePropertyType(String propertyExpression) {
    Tree ast = PropertyParser.parse(propertyExpression);
    if (PropertyParser.isPropertyDynamic(ast))
    {
        return org.w3c.dom.Node.class;
    }
    else
    {
        return String.class;
    }
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:12,代码来源:SimpleXMLEventType.java

示例14: doResolvePropertyType

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
private Class doResolvePropertyType(String propertyExpression, boolean allowSimpleProperties) {

        // see if this is an indexed property
        int index = ASTFilterSpecHelper.unescapedIndexOfDot(propertyExpression);
        if ((!allowSimpleProperties) && (index == -1))
        {
            // parse, can be an indexed property
            Property property = PropertyParser.parse(propertyExpression, false);
            if (!property.isDynamic())
            {
                if (!(property instanceof IndexedProperty))
                {
                    return null;
                }
                IndexedProperty indexedProp = (IndexedProperty) property;
                EventPropertyDescriptor descriptor = propertyDescriptorMap.get(indexedProp.getPropertyNameAtomic());
                if (descriptor == null)
                {
                    return null;
                }
                return descriptor.getPropertyType();
            }
        }

        Property prop = PropertyParser.parse(propertyExpression, false);
        if (prop.isDynamic())
        {
            return Node.class;
        }
        
        SchemaItem item = prop.getPropertyTypeSchema(schemaModelRoot, this.getEventAdapterService());
        if (item == null)
        {
            return null;
        }

        return SchemaUtil.toReturnType(item);
    }
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:39,代码来源:SchemaXMLEventType.java

示例15: resolveDynamicProperty

import com.espertech.esper.event.property.PropertyParser; //导入依赖的package包/类
private TypedEventPropertyGetter resolveDynamicProperty(String property) throws XPathExpressionException {
    // not defined, come up with an XPath
    EsperEPL2GrammarParser.StartEventPropertyRuleContext ast = PropertyParser.parse(property);
    String xPathExpr = SimpleXMLPropertyParser.walk(ast, property, config.getRootElementName(), defaultNamespacePrefix, config.isResolvePropertiesAbsolute());
    return resolvePropertyGetter(property, xPathExpr, XPathConstants.STRING, null);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:7,代码来源:AxiomXMLEventType.java


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