當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。