org.babyfish.collection.XOrderedMap类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(11.0k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.babyfish.collection.XOrderedMap类的一些代码示例,展示了XOrderedMap类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XOrderedMap类的具体详情如下:
包路径:org.babyfish.collection.XOrderedMap
类名称:XOrderedMap

XOrderedMap介绍

暂无

代码示例

代码示例来源:origin: babyfish-ct/babyfish

  1. private void registerSelfStackTopInsnNode() {
  2. List<Object> stack = this.stack;
  3. if (stack != null &&
  4. !stack.isEmpty() &&
  5. stack.get(stack.size() - 1).equals(this.metadataClass.getInternalName())) {
  6. this.selfWillBeStackTopInsnMap.put(
  7. ((MethodNode)this.mv).instructions.getLast(),
  8. stack.size()
  9. );
  10. }
  11. }

代码示例来源:origin: babyfish-ct/babyfish

  1. private void buildPolymorphicTarget() {
  2. for (ClassEntry classEntry : this.classEntries.values()) {
  3. for (MethodEntry methodEntry : classEntry.methodEntries.values()) {
  4. MethodEntry polymorphicTarget = methodEntry;
  5. while (true) {
  6. if (polymorphicTarget.overrideTarget != null) {
  7. polymorphicTarget = polymorphicTarget.overrideTarget;
  8. } else if (polymorphicTarget.bridgeTarget != null) {
  9. polymorphicTarget = polymorphicTarget.bridgeTarget;
  10. } else {
  11. break;
  12. }
  13. }
  14. methodEntry.polymorphicTarget = polymorphicTarget;
  15. }
  16. }
  17. }

代码示例来源:origin: babyfish-ct/babyfish

  1. private void buildOverrideChain() {
  2. ClassEntry[] arr =
  3. this.classEntries.values().toArray(
  4. new ClassEntry[this.classEntries.size()]);
  5. for (int i = 0; i < arr.length; i++) {
  6. for (int ii = i + 1; ii < arr.length; ii++) {
  7. for (MethodEntry methodEntry1 : arr[i].methodEntries.values()) {
  8. int access1 = methodEntry1.methodNode.access;
  9. if ((access1 & (Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_PRIVATE)) == 0) {
  10. MethodEntry methodEntry2 = arr[ii].methodEntries.get(methodEntry1.getDescriptor());
  11. if (methodEntry2 != null) {
  12. int access2 = methodEntry1.methodNode.access;
  13. if ((access2 & (Opcodes.ACC_STATIC | Opcodes.ACC_PRIVATE)) == 0) {
  14. methodEntry1.overrideTarget = methodEntry2;
  15. }
  16. }
  17. }
  18. }
  19. }
  20. }
  21. }

代码示例来源:origin: babyfish-ct/babyfish

  1. public void resolvePropertyList() {
  2. if (this.propertyList != null) {
  3. return;
  4. }
  5. if (this.superClass != null) {
  6. this.superClass.resolvePropertyList();
  7. }
  8. int propertyId = this.superClass != null ? this.superClass.propertyList.size() : 0;
  9. JPAMetadataPropertyImpl[] arr = new JPAMetadataPropertyImpl[propertyId + this.declaredProperties.size()];
  10. if (this.superClass != null) {
  11. this.superClass.propertyList.toArray(arr);
  12. }
  13. for (JPAMetadataPropertyImpl property : this.declaredProperties.values()) {
  14. arr[propertyId] = property;
  15. property.id = propertyId++;
  16. }
  17. this.propertyList = MACollections.wrap(arr);
  18. }

代码示例来源:origin: babyfish-ct/babyfish

  1. public PathPlanKeyBuilder setQueryPaths(String alias, Collection<? extends QueryPath> queryPaths) {
  2. if (queryPaths == null || queryPaths.isEmpty()) {
  3. this.queryPathMap.remove(alias);
  4. }
  5. XOrderedSet<QueryPath> set = new LinkedHashSet<>((queryPaths.size() * 4 + 2) / 3);
  6. for (QueryPath queryPath : queryPaths) {
  7. if (queryPath != null) {
  8. set.add(QueryPaths.toStandard(queryPath));
  9. }
  10. }
  11. this.queryPathMap.put(alias, queryPaths.toArray(new QueryPath[set.size()]));
  12. this.key = null;
  13. return this;
  14. }

代码示例来源:origin: babyfish-ct/babyfish

  1. public void resolveProperties() {
  2. if (this.properties != null) {
  3. return;
  4. }
  5. if (this.superClass == null) {
  6. this.properties = this.declaredProperties;
  7. return;
  8. }
  9. this.superClass.resolveProperties();
  10. if (this.declaredProperties.isEmpty()) {
  11. this.properties = this.superClass.properties;
  12. return;
  13. }
  14. XOrderedMap<String, JPAMetadataPropertyImpl> map = new LinkedHashMap<>(this.superClass.properties);
  15. for (JPAMetadataPropertyImpl property : this.declaredProperties.values()) {
  16. MetadataProperty superProperty = map.put(property.getName(), property);
  17. if (superProperty != null && !superProperty.getName().equals(property.unresolved.contravarianceFrom)) {
  18. throw new IllegalClassException(
  19. missContravarinaceWithSameName(
  20. property,
  21. superProperty,
  22. Contravariance.class,
  23. property.getName()
  24. )
  25. );
  26. }
  27. }
  28. this.properties = MACollections.unmodifiable(map);
  29. }

代码示例来源:origin: babyfish-ct/babyfish

  1. protected LiteralParameter getLiteralParameter(Object object) {
  2. XOrderedMap<Object, LiteralParameter> literalParameters = this.literalParameters;
  3. if (literalParameters == null) {
  4. this.literalParameters = literalParameters = new LinkedHashMap<>();
  5. }
  6. LiteralParameter literalParameter = literalParameters.get(object);
  7. if (literalParameter == null) {
  8. if (object instanceof LiteralExpression<?>) {
  9. literalParameter = new LiteralParameter(literalParameters.size(),
  10. ((LiteralExpression<?>)object).getValue());
  11. } else if (object instanceof Partition<?>) {
  12. Collection<Object> c = new ArrayList<>();
  13. for (Expression<?> value : ((Partition<?>)object).getValues()) {
  14. if (value instanceof LiteralExpression<?>) {
  15. c.add(((LiteralExpression<?>)value).getValue());
  16. } else {
  17. c.add(((ConstantExpression<?>)value).getValue());
  18. }
  19. }
  20. literalParameter = new LiteralParameter(literalParameters.size(), c);
  21. } else {
  22. Arguments.mustBeInstanceOfAnyOfValue("object", object, LiteralExpression.class, Partition.class);
  23. }
  24. literalParameters.put(object, literalParameter);
  25. }
  26. return literalParameter;
  27. }

代码示例来源:origin: babyfish-ct/babyfish

  1. for (int i = 0; i < catches.length; i++) {
  2. for (String exceptionInternalName : catches[i].getExceptionInternalNames()) {
  3. catchLabels.put(exceptionInternalName, new Label());
  4. catchActions.put(exceptionInternalName, catches[i].getMvAction());
  5. for (Entry<String, Label> entry : catchLabels.entrySet()) {
  6. innerMV.visitTryCatchBlock(
  7. tryLabel,
  8. catchLabels.firstEntry().getValue(),
  9. entry.getValue(),
  10. entry.getKey());
  11. innerMV.visitJumpInsn(Opcodes.GOTO, endLabel);
  12. for (Entry<String, Label> entry : catchLabels.entrySet()) {
  13. innerMV.visitLabel(entry.getValue());
  14. catchActions.get(entry.getKey()).accept(this);
  15. innerMV.visitJumpInsn(Opcodes.GOTO, endLabel);

代码示例来源:origin: babyfish-ct/babyfish

  1. compileResult = LEVEL_TWO_CACHE.access(queryPath); //1st level-2 reading
  2. compileResult = LEVEL_TWO_CACHE.access(queryPath); //2nd level-2 reading
  3. if (compileResult == null) { //2nd level-2 checking
  4. ANTLRInputStream input = new ANTLRInputStream(queryPath);
  5. for (int i = LEVEL_TWO_CACHE.size() - LEVEL_2_CACHE_MAX_SIZE; i >= 0; i--) {
  6. LEVEL_TWO_CACHE.pollFirstEntry();
  7. LEVEL_TWO_CACHE.put(queryPath, compileResult);

代码示例来源:origin: babyfish-ct/babyfish

  1. if (!allEntityMap.containsKey(fromElementAlias)) {
  2. allEntityMap.put(fromElementAlias, index);
  3. Integer column;
  4. if (subPlanAlias != null) {
  5. column = allEntityMap.get(subPlanAlias);
  6. if (column == null) {
  7. throw new QueryException(
  8. column = allEntityMap.firstEntry().getValue();

代码示例来源:origin: babyfish-ct/babyfish

  1. MethodEntry getMethodEntry(Descriptor descriptor) {
  2. MethodEntry methodEntry = this.methodEntries.get(descriptor);
  3. if (methodEntry == null) {
  4. if (this.superClassEntry == null) {
  5. return null;
  6. }
  7. methodEntry = this.superClassEntry.getMethodEntry(descriptor);
  8. }
  9. return methodEntry;
  10. }

代码示例来源:origin: babyfish-ct/babyfish

  1. ClassEntry lastEntry = this.classEntries.lastEntry().getValue();
  2. ClassNode newClassNode = new ClassNode();
  3. newClassNode.version = Opcodes.V1_7;
  4. for (MethodEntry methodEntry : lastEntry.methodEntries.values()) {
  5. MethodNode methodNode = methodEntry.methodNode;
  6. if ("<init>".equals(methodNode.name) &&
  7. newClassEntry.superClassEntry = this.classEntries.lastEntry().getValue();
  8. this.newClassEntry = newClassEntry;
  9. this.classEntries.put(newClassNode.name, newClassEntry);
  10. return retval;

代码示例来源:origin: babyfish-ct/babyfish

  1. !isSystemClass(clazz);
  2. clazz = clazz.getSuperclass()) {
  3. classEntries.put(
  4. clazz.getName().replace('.', '/'),
  5. new ClassEntry(clazz));
  6. for (ClassEntry classEntry : classEntries.values()) {
  7. classEntry.superClassEntry = superClassEntry;
  8. superClassEntry = classEntry;

代码示例来源:origin: babyfish-ct/babyfish

  1. private void buildBridgeChain() {
  2. for (ClassEntry classEntry : this.classEntries.values()) {
  3. for (MethodEntry methodEntry : classEntry.methodEntries.values()) {
  4. if ((methodEntry.methodNode.access & Opcodes.ACC_BRIDGE) != 0) {
  5. if (methodEntry.instructions.size() < 3) {
  6. MethodEntry targetMethodEntry = classEntry.methodEntries.get(
  7. new Descriptor(invokeVirtualNode.name, invokeVirtualNode.desc));
  8. if (targetMethodEntry == null) {

代码示例来源:origin: babyfish-ct/babyfish

  1. private void modifyNewClassNode() {
  2. ClassEntry newClassEntry = this.newClassEntry;
  3. ClassNode newClassNode = newClassEntry.classNode;
  4. List<ClassEntry> ces = new ArrayList<>(this.classEntries.size() + this.invokedEntries.size());
  5. ces.addAll(this.classEntries.values());
  6. ces.addAll(this.invokedEntries.values());
  7. for (ClassEntry ce : ces) {
  8. for (FieldEntry fieldEntry : ce.fieldEntries.values()) {
  9. if (fieldEntry.getterDescriptorToAvoidIllegalAccessing != null ||
  10. fieldEntry.setterDescriptorToAvoidIllegalAccessing != null) {
  11. for (MethodEntry methodEntry : ce.methodEntries.values()) {
  12. if (methodEntry.changed) {
  13. String methodName;
  14. List<TryCatchBlockNode> tmpTryCatchBlocks = new ArrayList<TryCatchBlockNode>();
  15. for (ClassEntry classEntry : ces) {
  16. for (FieldEntry fieldEntry : classEntry.fieldEntries.values()) {
  17. if (fieldEntry.getterDescriptorToAvoidIllegalAccessing != null ||
  18. fieldEntry.setterDescriptorToAvoidIllegalAccessing != null) {
  19. for (MethodEntry methodEntry : classEntry.methodEntries.values()) {
  20. if (methodEntry.descriptorToAvoidIllegalAccessing != null) {
  21. Type[] parameterTypes = Type.getArgumentTypes(methodEntry.getDescriptor().desc);
  22. MethodNode clinitNode = this.newClassEntry.getMethodEntry(clinitDescriptor).methodNode;
  23. if (clinitNode.instructions.size() == 0 && tmpInstructions.size() == 0) {
  24. this.newClassEntry.methodEntries.remove(clinitDescriptor);
  25. this.newClassEntry.classNode.methods.remove(clinitNode);
  26. } else {

代码示例来源:origin: babyfish-ct/babyfish

  1. public MethodSource getMethodSource(Method method) {
  2. ClassEntry classEntry = this.context.classEntries.get(
  3. Type.getInternalName(method.getDeclaringClass()));
  4. if (classEntry != null) {
  5. MethodEntry methodEntry = classEntry.methodEntries.get(
  6. new Descriptor(method.getName(), Type.getMethodDescriptor(method)));
  7. return new MethodSource(methodEntry);
  8. }
  9. throw new IllegalArgumentException(
  10. canNotFindMethodSource(
  11. this.context.owner().getClass(),
  12. method,
  13. this.context.classEntries.firstEntry().getValue().clazz
  14. )
  15. );
  16. }
  17. }

代码示例来源:origin: babyfish-ct/babyfish

  1. for (MetadataProperty metadataProperty : this.getMetadataClass().getDeclaredProperties().values()) {
  2. this.generatePropertyFields(cv, metadataProperty);
  3. for (MetadataProperty metadataProperty : this.getMetadataClass().getDeclaredProperties().values()) {
  4. this.generatePropertyGetter(cv, metadataProperty);
  5. this.generatePropertySetter(cv, metadataProperty);
  6. if (this.getMetadataClass().getSuperClass() == null || !this.getMetadataClass().getDeclaredProperties().isEmpty()) {
  7. this.generateWriteObject(cv);
  8. this.generateReadObject(cv);

代码示例来源:origin: babyfish-ct/babyfish

  1. @Override
  2. public void visitFieldInsn(int opcode, String owner, String name, String desc) {
  3. if (owner.equals(this.metadataClass.getInternalName()) &&
  4. this.metadataClass.getDeclaredProperties().containsKey(name)) {
  5. MetadataProperty metadataProperty = this.metadataClass.getDeclaredProperties().get(name);
  6. Integer stackLength = this.stack.size();
  7. if (opcode == Opcodes.PUTFIELD) {
  8. abstractInsnNode != null;
  9. abstractInsnNode = abstractInsnNode.getPrevious()) {
  10. if (stackLength.equals(this.selfWillBeStackTopInsnMap.get(abstractInsnNode))) {
  11. FieldInsnNode objectModelFieldInsnNode =
  12. new FieldInsnNode(

代码示例来源:origin: babyfish-ct/babyfish

  1. @Override
  2. protected XEntry<K, V> createBaseView(
  3. XOrderedMap<K, V> baseMap, ViewInfo viewInfo) {
  4. if (viewInfo instanceof OrderedMapViewInfos.FirstEntry) {
  5. return baseMap.firstEntry();
  6. }
  7. throw new IllegalArgumentException(CommonMessages.illegalViewInfo());
  8. }

代码示例来源:origin: babyfish-ct/babyfish

  1. @Override
  2. public V access(K key) {
  3. this.enable();
  4. return this.<XOrderedMap<K, V>>getBase().access(key);
  5. }

相关文章