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