Package jodd.mutable

Examples of jodd.mutable.MutableInteger



  @Override
  public SignatureVisitor visitReturnType() {
    super.visitReturnType();
    returnOpcodeType = new MutableInteger();
    returnTypeName = new StringBuilder();
    return new MethodSignatureVisitor(returnType, returnOpcodeType, returnTypeName);
  }
View Full Code Here


    assertNull(cache.get("5"));
  }

  @Test
  public void testOnRemove() {
    final MutableInteger mutableInteger = new MutableInteger();
    Cache<String, String> cache = new LFUCache<String, String>(2) {
      @Override
      protected void onRemove(String key, String cachedObject) {
        mutableInteger.value++;
      }
View Full Code Here

public class ObjectUtilTest {

  @Test
  public void testCloneViaSerialization() throws Exception {

    MutableInteger mu = new MutableInteger(183);

    MutableInteger mu2 = ObjectUtil.cloneViaSerialization(mu);

    assertFalse(mu == mu2);
    assertTrue(mu.equals(mu2));
    assertEquals(mu.intValue(), mu2.intValue());
  }
View Full Code Here

    int ndx = className.lastIndexOf('.');
    classShortName = ndx == -1 ? className : className.substring(ndx + 1);

    // arguments
    List<String> args = new ArrayList<String>();
    MutableInteger from = new MutableInteger(1);
    if (description.length() != 0) {
      while (description.charAt(from.value) != ')') {
        String a = AsmUtil.typedescToSignature(description, from);
        args.add(a);
      }
View Full Code Here


  @Override
  public SignatureVisitor visitReturnType() {
    super.visitReturnType();
    returnOpcodeType = new MutableInteger();
    returnTypeName = new StringBuilder();
    return new MethodSignatureVisitor(returnType, returnOpcodeType, returnTypeName);
  }
View Full Code Here

   * Processes input JSP content and replace macros.
   */
  public String process(final String input) {
    LagartoParser lagartoParser = new LagartoParser(input, true);

    final MutableInteger lastPosition = new MutableInteger(0);
    final StringBuilder sb = new StringBuilder();

    lagartoParser.parse(new EmptyTagVisitor() {
      @Override
      public void tag(Tag tag) {
        if (tag.getType() == TagType.SELF_CLOSING) {
          if (tag.matchTagNamePrefix(tagPrefix)) {
            int tagStart = tag.getTagPosition();

            sb.append(input.substring(lastPosition.getValue(), tagStart));

            String tagName = tag.getName().toString();
            tagName = tagName.substring(tagPrefix.length);

            String macroBody = loadMacro(tagName);

            int attrCount = tag.getAttributeCount();

            for (int i = 0; i < attrCount; i++) {
              String key = macroPrefix + tag.getAttributeName(i) + macroSuffix;
              macroBody = StringUtil.replace(macroBody, key, tag.getAttributeValue(i).toString());
            }

            sb.append(macroBody);

            lastPosition.setValue(tagStart + tag.getTagLength());
          }
        }
      }
    });

    sb.append(input.substring(lastPosition.getValue()));

    return sb.toString();
  }
View Full Code Here

  /**
   * Returns java-like signature of a bytecode-like description.
   * @see #typedescToSignature(String, jodd.mutable.MutableInteger)
   */
  public static String typedescToSignature(String desc) {
    return typedescToSignature(desc, new MutableInteger());
  }
View Full Code Here

    assertEquals(123, d.intValue());

    s = TypeConverterManager.convertType(d, String.class);
    assertEquals("123", s);

    MutableInteger md = TypeConverterManager.convertType(s, MutableInteger.class);
    assertEquals(123, md.intValue());

    B b = new B();
    A a = TypeConverterManager.convertType(b, A.class);
    assertEquals(a, b);
  }
View Full Code Here

  }

  public static <T> Iterable<T> iterableo(final T... v) {
    return new Iterable<T>() {
      public Iterator<T> iterator() {
        final MutableInteger index = new MutableInteger(0);
        return new Iterator<T>() {
          public boolean hasNext() {
            return index.value < v.length;
          }
View Full Code Here

  public void testConversion() {
    MutableIntegerConverter mutableIntegerConverter = (MutableIntegerConverter) TypeConverterManager.lookup(MutableInteger.class);

    assertNull(mutableIntegerConverter.convert(null));

    assertEquals(new MutableInteger(1), mutableIntegerConverter.convert(new MutableInteger(1)));
    assertEquals(new MutableInteger(1), mutableIntegerConverter.convert(Integer.valueOf(1)));
    assertEquals(new MutableInteger(1), mutableIntegerConverter.convert(Short.valueOf((short) 1)));
    assertEquals(new MutableInteger(1), mutableIntegerConverter.convert(Double.valueOf(1.0D)));
    assertEquals(new MutableInteger(1), mutableIntegerConverter.convert("1"));
    assertEquals(new MutableInteger(1), mutableIntegerConverter.convert(" 1 "));

    try {
      mutableIntegerConverter.convert("a");
      fail();
    } catch (TypeConversionException ignore) {
View Full Code Here

TOP

Related Classes of jodd.mutable.MutableInteger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.