/** * When set synchronized, non-method settings are cleared. * * @param b true to set synchronized, false otherwise */ public Modifiers toSynchronized(boolean b) { return convert(toSynchronized(mBitmask, b)); }
modifiers = modifiers.toStatic(true); } else if ("synchronized".equals(ident)) { modifiers = modifiers.toSynchronized(true); } else if ("strict".equals(ident)) { modifiers = modifiers.toStrict(true);
/** * When set synchronized, non-method settings are cleared. * * @param b true to set synchronized, false otherwise */ public Modifiers toSynchronized(boolean b) { return convert(toSynchronized(mBitmask, b)); }
modifiers = modifiers.toStatic(true); } else if ("synchronized".equals(ident)) { modifiers = modifiers.toSynchronized(true); } else if ("strict".equals(ident)) { modifiers = modifiers.toStrict(true);
/** * Defines a hashCode method. */ private void addHashCodeMethod() { Modifiers modifiers = Modifiers.PUBLIC.toSynchronized(true); MethodInfo mi = addMethodIfNotFinal(modifiers, "hashCode", TypeDesc.INT, null); if (mi == null) { return; } CodeBuilder b = new CodeBuilder(mi); boolean mixIn = false; for (StorableProperty property : mAllProperties.values()) { if (property.isDerived() || property.isJoin()) { continue; } TypeDesc fieldType = TypeDesc.forClass(property.getType()); b.loadThis(); b.loadField(property.getName(), fieldType); CodeBuilderUtil.addValueHashCodeCall(b, fieldType, true, mixIn); mixIn = true; } b.returnValue(TypeDesc.INT); }
/** * Defines a hashCode method. */ private void addHashCodeMethod() { Modifiers modifiers = Modifiers.PUBLIC.toSynchronized(true); MethodInfo mi = addMethodIfNotFinal(modifiers, "hashCode", TypeDesc.INT, null); if (mi == null) { return; } CodeBuilder b = new CodeBuilder(mi); boolean mixIn = false; for (StorableProperty property : mAllProperties.values()) { if (property.isDerived() || property.isJoin()) { continue; } TypeDesc fieldType = TypeDesc.forClass(property.getType()); b.loadThis(); b.loadField(property.getName(), fieldType); CodeBuilderUtil.addValueHashCodeCall(b, fieldType, true, mixIn); mixIn = true; } b.returnValue(TypeDesc.INT); }
addMethodIfNotFinal(Modifiers.PUBLIC.toSynchronized(true), name, null, null);
addMethodIfNotFinal(Modifiers.PUBLIC.toSynchronized(true), name, null, null);
private void addMarkDirtyMethod(String name) { MethodInfo mi = addMethodIfNotFinal(Modifiers.PUBLIC.toSynchronized(true), name, null, null);
private void addMarkDirtyMethod(String name) { MethodInfo mi = addMethodIfNotFinal(Modifiers.PUBLIC.toSynchronized(true), name, null, null);
TypeDesc stringBuilder = TypeDesc.forClass(StringBuilder.class); Modifiers modifiers = Modifiers.PUBLIC.toSynchronized(true); MethodInfo mi = addMethodIfNotFinal(modifiers, keyOnly ?
TypeDesc stringBuilder = TypeDesc.forClass(StringBuilder.class); Modifiers modifiers = Modifiers.PUBLIC.toSynchronized(true); MethodInfo mi = addMethodIfNotFinal(modifiers, keyOnly ?
private void addWriteToMethod() { TypeDesc streamType = TypeDesc.forClass(OutputStream.class); MethodInfo mi = addMethodIfNotFinal(Modifiers.PUBLIC.toSynchronized(true), WRITE_TO, null, new TypeDesc[] {streamType}); if (mi == null) { return; } GenericEncodingStrategy<S> encoder = new GenericEncodingStrategy<S>(mStorableType, null); CodeBuilder b = new CodeBuilder(mi); LocalVariable encodedVar; try { encodedVar = encoder.buildSerialEncoding(b, null); } catch (SupportException e) { // Wipe out any code generated so far. b = new CodeBuilder(mi); CodeBuilderUtil.throwException(b, SupportException.class, e.getMessage()); return; } b.loadLocal(encodedVar); b.arrayLength(); b.loadLocal(b.getParameter(0)); b.invokeStatic(TypeDesc.forClass(DataEncoder.class), "writeLength", TypeDesc.INT, new TypeDesc[] {TypeDesc.INT, streamType}); b.pop(); b.loadLocal(b.getParameter(0)); b.loadLocal(encodedVar); b.invokeVirtual(streamType, "write", null, new TypeDesc[] {encodedVar.getType()}); b.returnVoid(); }
private void addWriteToMethod() { TypeDesc streamType = TypeDesc.forClass(OutputStream.class); MethodInfo mi = addMethodIfNotFinal(Modifiers.PUBLIC.toSynchronized(true), WRITE_TO, null, new TypeDesc[] {streamType}); if (mi == null) { return; } GenericEncodingStrategy<S> encoder = new GenericEncodingStrategy<S>(mStorableType, null); CodeBuilder b = new CodeBuilder(mi); LocalVariable encodedVar; try { encodedVar = encoder.buildSerialEncoding(b, null); } catch (SupportException e) { // Wipe out any code generated so far. b = new CodeBuilder(mi); CodeBuilderUtil.throwException(b, SupportException.class, e.getMessage()); return; } b.loadLocal(encodedVar); b.arrayLength(); b.loadLocal(b.getParameter(0)); b.invokeStatic(TypeDesc.forClass(DataEncoder.class), "writeLength", TypeDesc.INT, new TypeDesc[] {TypeDesc.INT, streamType}); b.pop(); b.loadLocal(b.getParameter(0)); b.loadLocal(encodedVar); b.invokeVirtual(streamType, "write", null, new TypeDesc[] {encodedVar.getType()}); b.returnVoid(); }
private void addReadFromMethod() { TypeDesc streamType = TypeDesc.forClass(InputStream.class); MethodInfo mi = addMethodIfNotFinal(Modifiers.PUBLIC.toSynchronized(true), READ_FROM, null, new TypeDesc[] {streamType}); if (mi == null) { return; } CodeBuilder b = new CodeBuilder(mi); TypeDesc dataDecoderType = TypeDesc.forClass(DataDecoder.class); b.loadLocal(b.getParameter(0)); b.invokeStatic(dataDecoderType, "readLength", TypeDesc.INT, new TypeDesc[] {streamType}); LocalVariable encodedVar = b.createLocalVariable(null, TypeDesc.forClass(byte[].class)); b.newObject(encodedVar.getType()); b.storeLocal(encodedVar); b.loadLocal(b.getParameter(0)); b.loadLocal(encodedVar); b.invokeStatic(dataDecoderType, "readFully", null, new TypeDesc[] {streamType, encodedVar.getType()}); GenericEncodingStrategy<S> encoder = new GenericEncodingStrategy<S>(mStorableType, null); try { encoder.buildSerialDecoding(b, null, encodedVar); } catch (SupportException e) { // Wipe out any code generated so far. b = new CodeBuilder(mi); CodeBuilderUtil.throwException(b, SupportException.class, e.getMessage()); return; } b.returnVoid(); }
private void addReadFromMethod() { TypeDesc streamType = TypeDesc.forClass(InputStream.class); MethodInfo mi = addMethodIfNotFinal(Modifiers.PUBLIC.toSynchronized(true), READ_FROM, null, new TypeDesc[] {streamType}); if (mi == null) { return; } CodeBuilder b = new CodeBuilder(mi); TypeDesc dataDecoderType = TypeDesc.forClass(DataDecoder.class); b.loadLocal(b.getParameter(0)); b.invokeStatic(dataDecoderType, "readLength", TypeDesc.INT, new TypeDesc[] {streamType}); LocalVariable encodedVar = b.createLocalVariable(null, TypeDesc.forClass(byte[].class)); b.newObject(encodedVar.getType()); b.storeLocal(encodedVar); b.loadLocal(b.getParameter(0)); b.loadLocal(encodedVar); b.invokeStatic(dataDecoderType, "readFully", null, new TypeDesc[] {streamType, encodedVar.getType()}); GenericEncodingStrategy<S> encoder = new GenericEncodingStrategy<S>(mStorableType, null); try { encoder.buildSerialDecoding(b, null, encodedVar); } catch (SupportException e) { // Wipe out any code generated so far. b = new CodeBuilder(mi); CodeBuilderUtil.throwException(b, SupportException.class, e.getMessage()); return; } b.returnVoid(); }
Modifiers modifiers = Modifiers.PUBLIC.toSynchronized(true); MethodInfo mi = addMethodIfNotFinal (modifiers, equalsMethodName, TypeDesc.BOOLEAN, objectParam);
Modifiers modifiers = Modifiers.PUBLIC.toSynchronized(true); MethodInfo mi = addMethodIfNotFinal (modifiers, equalsMethodName, TypeDesc.BOOLEAN, objectParam);
(Modifiers.PUBLIC.toSynchronized(true), methodName, null, param);