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


Java Property类代码示例

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


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

示例1: getPropertyMapFromClass

import org.directwebremoting.extend.Property; //导入依赖的package包/类
@Override
public Map<String, Property> getPropertyMapFromClass(Class<?> type, boolean readRequired, boolean writeRequired) throws ConversionException
{
    Map<String, Property> descriptors = super.getPropertyMapFromClass(type, readRequired, writeRequired);
    descriptors.put("javaClassName", new PlainProperty("javaClassName", type.getName()));

    // Make sure Throwable's standard properties are added
    // (fix for Bean Introspector peculiarities)
    try
    {
        fixMissingThrowableProperty(descriptors, "message", "getMessage");
        fixMissingThrowableProperty(descriptors, "cause", "getCause");
    }
    catch (IntrospectionException ex)
    {
        throw new ConversionException(type, ex);
    }

    return descriptors;
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:21,代码来源:ExceptionConverter.java

示例2: convertInbound

import org.directwebremoting.extend.Property; //导入依赖的package包/类
@Ignore
@Test
public void convertInbound() throws Exception
{
    // also test with an instance type
    InboundVariable var = new InboundVariable(null, null, "type", "{ property: bla }");
    converter.setInstanceType(MyBeanImpl.class);

    EasyMock.expect(manager.convertInbound(EasyMock.eq(String.class),
            EasyMock.isA(InboundVariable.class),
            EasyMock.isA(Property.class))).andReturn("bla");
    EasyMock.replay(manager);

    Object result = converter.convertInbound(Object.class, var);
    assertNotNull(result);
    assertTrue(result instanceof MyBeanImpl);
    MyBeanImpl bean = (MyBeanImpl) result;
    assertEquals("bla", bean.getProperty());

    EasyMock.verify(manager);
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:22,代码来源:BeanConverterTest.java

示例3: getPropertyMapFromClass

import org.directwebremoting.extend.Property; //导入依赖的package包/类
@Override
public Map<String, Property> getPropertyMapFromClass(Class<?> type, boolean readRequired, boolean writeRequired) throws ConversionException
{
    Map<String, Property> descriptors = new HashMap<String, Property>();

    descriptors.put("message", new PlainProperty("message", "Error"));
    descriptors.put("javaClassName", new PlainProperty("javaClassName", "java.lang.Throwable"));

    return descriptors;
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:11,代码来源:MinimalistExceptionConverter.java

示例4: convert

import org.directwebremoting.extend.Property; //导入依赖的package包/类
/**
 * We have inbound data and a type that we need to convert it into, this
 * method performs the conversion.
 */
protected Object convert(String val, Class<?> propType, InboundContext inboundContext, Property property)
{
    String[] split = ConvertUtil.splitInbound(val);
    String splitValue = split[ConvertUtil.INBOUND_INDEX_VALUE];
    String splitType = split[ConvertUtil.INBOUND_INDEX_TYPE];

    InboundVariable nested = new InboundVariable(inboundContext, null, splitType, splitValue);
    nested.dereference();
    Property incc = createTypeHintContext(inboundContext, property);

    return converterManager.convertInbound(propType, nested, incc);
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:17,代码来源:BasicObjectConverter.java

示例5: fixMissingThrowableProperty

import org.directwebremoting.extend.Property; //导入依赖的package包/类
/**
 * Make sure Throwable's standard properties are added
 * (fix for Bean Introspector peculiarities)
 * @param descriptors The Map of the known descriptors
 * @param name The name of the property to add
 * @param readMethodName A method name to use when getting said property
 * @throws IntrospectionException If we fail to build a PropertyDescriptor
 */
protected void fixMissingThrowableProperty(Map<String, Property> descriptors, String name, String readMethodName) throws IntrospectionException
{
    if (!descriptors.containsKey(name) && isAllowedByIncludeExcludeRules(name))
    {
        PropertyDescriptor descriptor = new PropertyDescriptor(name, Throwable.class, readMethodName, null);
        descriptors.put(name, new PropertyDescriptorProperty(descriptor));
    }
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:17,代码来源:ExceptionConverter.java

示例6: convertInbound

import org.directwebremoting.extend.Property; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T> T convertInbound(Class<T> paramType, InboundVariable data, Property thc) throws ConversionException
{
    InboundContext context = data.getContext();

    Object converted = context.getConverted(data, paramType);
    if (converted == null)
    {
        Converter converter = null;

        // Was the inbound variable marshalled as an Object in the client
        // (could mean that this is an instance of one of our generated
        // JavaScript classes)
        String type = data.getNamedObjectType();
        if (type != null)
        {
            converter = getNamedConverter(type, paramType);
        }

        // Fall back to the standard way of locating a converter if we
        // didn't find anything above
        if (converter == null)
        {
            converter = getConverter(paramType);
        }

        if (converter == null)
        {
            log.error("Missing converter. Context of conversion: " + thc);
            throw new ConversionException(paramType, "No inbound converter found for property '" + thc.getName() + "' of type '" + paramType.getName() + "'");
        }

        context.pushContext(thc);
        converted = converter.convertInbound(paramType, data);
        context.popContext();
    }

    return (T) converted;
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:40,代码来源:DefaultConverterManager.java

示例7: checkOverride

import org.directwebremoting.extend.Property; //导入依赖的package包/类
public Property checkOverride(Property property)
{
    Property override = propertyOverrideMap.get(property);
    if (override != null)
    {
        return override;
    }
    else
    {
        return property;
    }
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:13,代码来源:DefaultConverterManager.java

示例8: executeCallback

import org.directwebremoting.extend.Property; //导入依赖的package包/类
/**
 * The reverse of {@link CallbackHelper#saveCallback(Callback, Class)}
 * which executes a {@link Callback} which has been called by the browser
 */
@SuppressWarnings("unchecked")
public static <T> void executeCallback(String key, RealRawData data) throws ConversionException
{
    WebContext webContext = WebContextFactory.get();
    ScriptSession session = webContext.getScriptSession();
    ConverterManager converterManager = webContext.getContainer().getBean(ConverterManager.class);

    Map<String, Class<T>> typeMap = (Map<String, Class<T>>) session.getAttribute(KEY_TYPE);
    Class<T> type = typeMap.remove(key);
    session.removeAttribute(KEY_TYPE);
    session.setAttribute(KEY_TYPE, typeMap);

    try
    {
        Method method = Callback.class.getMethod("dataReturned", type);

        Property property = new ParameterProperty(new MethodDeclaration(method), 0);
        InboundVariable iv = data.getInboundVariable();
        Object callbackData  = converterManager.convertInbound(type, iv, property);

        Map<String, Callback<T>> callbackMap = (Map<String, Callback<T>>) session.getAttribute(KEY_TYPE);
        Callback<T> callback = callbackMap.remove(key);
        session.removeAttribute(KEY_TYPE);
        session.setAttribute(KEY_CALLBACK, callbackMap);

        callback.dataReturned((T) callbackData);
    }
    catch (Exception ex)
    {
        throw new ConversionException(type, ex);
    }
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:37,代码来源:DefaultCallbackHelper.java

示例9: testParse1

import org.directwebremoting.extend.Property; //导入依赖的package包/类
@Test
public void testParse1() throws NoSuchMethodException
{
    Method expectedMethod = SignatureTestsObject.class.getMethod("setLotteryResults", java.util.List.class);
    Property expectedProperty = new ParameterProperty(new MethodDeclaration(expectedMethod), 0);
    EasyMock.expect(converterManager.checkOverride(EasyMock.isA(Property.class))).andReturn(expectedProperty);
    converterManager.setOverrideProperty(EasyMock.isA(Property.class), EasyMock.isA(Property.class));
    EasyMock.replay(converterManager);
    parser.parse("import java.util.*;\n" + "  import org.directwebremoting.impl.test.SignatureTestsObject;\n"
        + "  public void SignatureTestsObject.setLotteryResults(List<Integer> nos);");
    EasyMock.verify(converterManager);
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:13,代码来源:SignatureParserTest.java

示例10: createTypeHintContext

import org.directwebremoting.extend.Property; //导入依赖的package包/类
protected TypeHintContext createTypeHintContext(InboundContext inctx, Property property)
{
    return new TypeHintContext(converterManager, property.getSetter(), 0);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:5,代码来源:BeanConverter.java

示例11: createTypeHintContext

import org.directwebremoting.extend.Property; //导入依赖的package包/类
protected TypeHintContext createTypeHintContext(InboundContext inctx, Property property)
{
    return inctx.getCurrentTypeHintContext();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:5,代码来源:ObjectConverter.java

示例12: convertInbound

import org.directwebremoting.extend.Property; //导入依赖的package包/类
public <T> T convertInbound(Class<T> paramType, InboundVariable iv, Property incc) throws ConversionException
{
    return converterManager.convertInbound(paramType, iv, incc);
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:5,代码来源:InternalConverterManager.java

示例13: checkOverride

import org.directwebremoting.extend.Property; //导入依赖的package包/类
public Property checkOverride(Property property)
{
    return converterManager.checkOverride(property);
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:5,代码来源:InternalConverterManager.java

示例14: setOverrideProperty

import org.directwebremoting.extend.Property; //导入依赖的package包/类
public void setOverrideProperty(Property original, Property replacement)
{
    converterManager.setOverrideProperty(original, replacement);
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:5,代码来源:InternalConverterManager.java

示例15: getPropertyMapFromObject

import org.directwebremoting.extend.Property; //导入依赖的package包/类
@Override
public Map<String, Property> getPropertyMapFromObject(Object example, boolean readRequired, boolean writeRequired) throws ConversionException
{
    Class<?> clazz = Hibernate.getClass(example);
    try
    {
        BeanInfo info = Introspector.getBeanInfo(clazz);

        Map<String, Property> properties = new HashMap<String, Property>();
        for (PropertyDescriptor descriptor : info.getPropertyDescriptors())
        {
            String name = descriptor.getName();

            // We don't marshall getClass()
            if ("class".equals(name))
            {
                continue;
            }

            // Access rules mean we might not want to do this one
            if (!isAllowedByIncludeExcludeRules(name))
            {
                continue;
            }

            if (readRequired && descriptor.getReadMethod() == null)
            {
                continue;
            }

            if (writeRequired && descriptor.getWriteMethod() == null)
            {
                continue;
            }

            properties.put(name, new H2PropertyDescriptorProperty(descriptor));
        }

        return properties;
    }
    catch (Exception ex)
    {
        throw new ConversionException(clazz, ex);
    }
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:46,代码来源:H2BeanConverter.java


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